From 4154eeb8ed88a94c13560d8b730814c1b5651ba5 Mon Sep 17 00:00:00 2001 From: Arik Chakma Date: Mon, 30 Sep 2024 21:28:59 +0600 Subject: [PATCH] feat: add github contributors leaderboard --- src/api/leaderboard.ts | 3 +++ .../Leaderboard/LeaderboardPage.tsx | 25 +++++++++++++++---- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/api/leaderboard.ts b/src/api/leaderboard.ts index 09d4c0bc6..1ba6131c6 100644 --- a/src/api/leaderboard.ts +++ b/src/api/leaderboard.ts @@ -17,6 +17,9 @@ export type ListLeaderboardStatsResponse = { currentMonth: LeadeboardUserDetails[]; lifetime: LeadeboardUserDetails[]; }; + githubContributors: { + currentMonth: LeadeboardUserDetails[]; + }; }; export function leaderboardApi(context: APIContext) { diff --git a/src/components/Leaderboard/LeaderboardPage.tsx b/src/components/Leaderboard/LeaderboardPage.tsx index 9c7e6e1d5..6224e8ee7 100644 --- a/src/components/Leaderboard/LeaderboardPage.tsx +++ b/src/components/Leaderboard/LeaderboardPage.tsx @@ -4,7 +4,7 @@ import type { ListLeaderboardStatsResponse, } from '../../api/leaderboard'; import { cn } from '../../lib/classname'; -import { FolderKanban, Zap, Trophy } from 'lucide-react'; +import { FolderKanban, Zap, Trophy, GitPullRequest } from 'lucide-react'; import { RankBadgeIcon } from '../ReactIcons/RankBadgeIcon'; import { TrophyEmoji } from '../ReactIcons/TrophyEmoji'; import { SecondPlaceMedalEmoji } from '../ReactIcons/SecondPlaceMedalEmoji'; @@ -64,6 +64,19 @@ export function LeaderboardPage(props: LeaderboardPageProps) { }, ]} /> + + ), + emptyText: 'No contributors this month', + }, + ]} + /> @@ -89,7 +102,7 @@ function LeaderboardLane(props: LeaderboardLaneProps) { return (
-
+

{title}

{tabs.length > 1 && ( @@ -128,19 +141,21 @@ function LeaderboardLane(props: LeaderboardLaneProps) {
    {usersToShow.map((user, counter) => { const avatar = user?.avatar - ? `${import.meta.env.PUBLIC_AVATAR_BASE_URL}/${user.avatar}` + ? user?.avatar?.startsWith('http') + ? user?.avatar + : `${import.meta.env.PUBLIC_AVATAR_BASE_URL}/${user.avatar}` : '/images/default-avatar.png'; const rank = counter + 1; return (
  • 3,