-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(about): add dynamic contributor list and improve UI
Signed-off-by: Robert Goniszewski <[email protected]>
- Loading branch information
1 parent
3da3e90
commit 5cad676
Showing
2 changed files
with
90 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import type { PageServerLoad } from '../$types'; | ||
|
||
type Contributor = { | ||
login: string; | ||
id: number; | ||
node_id: string; | ||
avatar_url: string; | ||
gravatar_id: string; | ||
url: string; | ||
html_url: string; | ||
followers_url: string; | ||
following_url: string; | ||
gists_url: string; | ||
starred_url: string; | ||
subscriptions_url: string; | ||
organizations_url: string; | ||
repos_url: string; | ||
events_url: string; | ||
received_events_url: string; | ||
type: string; | ||
site_admin: boolean; | ||
contributions: number; | ||
}; | ||
|
||
export const load: PageServerLoad = async () => { | ||
const response = await fetch('https://api.github.com/repos/goniszewski/grimoire/contributors'); | ||
const contributors = await response | ||
.json() | ||
.then((data:Contributor[]) => | ||
data.filter( | ||
(contributor) => contributor.type === 'User' && contributor.login !== 'goniszewski' | ||
) | ||
.sort((a, b) => b.contributions - a.contributions).splice(0, 10)) | ||
|
||
return { | ||
contributors | ||
}; | ||
}; |
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