-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move community Github and Board widgets from devgogigs to devhub (#561)
* fix solution action * added required components * remove unnecessary code * add hidden btn * update github configurator * prettier update * fix flash error issue * more improvements * prettier update * refactor code * add comment * added state for when no configurations exists * fix pagination error * handle error * fix map error * fix amount issue * updated UI * decoupled state * remove replace fn * remove title on new column --------- Co-authored-by: T guntenaar <[email protected]>
- Loading branch information
1 parent
d81cfc5
commit da86a64
Showing
15 changed files
with
1,544 additions
and
451 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const DataRequest = { | ||
/** | ||
* Requests all the data from non-empty pages of the paginated API. | ||
* | ||
* **Notice: currently expected to work only with array responses.** | ||
* | ||
* @param {object} parameters | ||
* Request parameters including the number of page to start with, | ||
* and an accumulated response buffer, if it exists. | ||
* | ||
* @param {array | null | undefined} parameters.buffer | ||
* @param {number} parameters.startWith | ||
* | ||
* @param {(pageNumber: number) => array} requestByNumber | ||
* | ||
* @returns {array} The final accumulated response. | ||
*/ | ||
paginated: (requestByNumber, { buffer, startWith }) => { | ||
const startPageNumber = startWith ?? 1, | ||
accumulatedResponse = buffer ?? []; | ||
|
||
const latestResponse = requestByNumber(startPageNumber) ?? []; | ||
|
||
if (latestResponse.length === 0) { | ||
return accumulatedResponse; | ||
} else { | ||
return DataRequest.paginated(requestByNumber, { | ||
buffer: [...accumulatedResponse, ...latestResponse], | ||
startWith: startPageNumber + 1, | ||
}); | ||
} | ||
}, | ||
}; | ||
|
||
return { DataRequest }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const uuid = () => | ||
[Date.now().toString(16)] | ||
.concat( | ||
Array.from( | ||
{ length: 4 }, | ||
() => Math.floor(Math.random() * 0xffffffff) & 0xffffffff | ||
).map((value) => value.toString(16)) | ||
) | ||
.join("-"); | ||
|
||
const withUUIDIndex = (data) => { | ||
const id = uuid(); | ||
|
||
return Object.fromEntries([[id, { ...data, id }]]); | ||
}; | ||
|
||
return { uuid, withUUIDIndex }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.