From e4380a22c453a273143d177b0644cef8778a2233 Mon Sep 17 00:00:00 2001 From: Ayush Jhawar Date: Wed, 12 Feb 2025 21:46:39 +0530 Subject: [PATCH 1/6] fix: special honor full timers --- .../src/components/ContributorOverview.tsx | 165 ++++++++++++------ 1 file changed, 111 insertions(+), 54 deletions(-) diff --git a/frontend/src/components/ContributorOverview.tsx b/frontend/src/components/ContributorOverview.tsx index a6b2c0c..3553f5d 100644 --- a/frontend/src/components/ContributorOverview.tsx +++ b/frontend/src/components/ContributorOverview.tsx @@ -9,15 +9,30 @@ import { ContributorCard } from "./ContributorCard" import { getAvatarUrl, getProfileUrl } from "../constants/github" import { CONTRIBUTION_TYPES, STATS_CONFIG } from "../constants/metrics" +const FULL_TIMERS = ["seveibar", "imrishabh18"] + export function ContributorOverview({ contributors, onSelectContributor, }: ContributorOverviewProps) { const [showAllContributors, setShowAllContributors] = useState(false) - // Get top 3 contributors for podium - const podiumContributors = contributors.slice(0, 3) - const remainingContributors = contributors.slice(3) + // First, separate full-timers from other contributors + const [fullTimerContributors, otherContributors] = contributors.reduce( + ([full, other], contributor) => { + if (FULL_TIMERS.includes(contributor[0])) { + return [[...full, contributor], other] + } + return [full, [...other, contributor]] + }, + [[] as [string, ContributorStats][], [] as [string, ContributorStats][]] + ) + + // Get top 3 contributors from non-full-timers + const podiumContributors = otherContributors.slice(0, 3) + const remainingContributors = otherContributors.slice(3).filter( + ([username]) => !FULL_TIMERS.includes(username) + ) const PodiumEntry = ({ position, @@ -29,35 +44,35 @@ export function ContributorOverview({ onClick, }: PodiumEntryProps) => { const sizes = { - sm: "md:w-20 md:h-20", - md: "md:w-24 md:h-24", - lg: "md:w-32 md:h-32", + sm: "md:w-24 md:h-24", + md: "md:w-28 md:h-28", + lg: "md:w-36 md:h-36", } const badgeSizes = { sm: "md:w-8 md:h-8 text-base", - md: "md:w-8 md:h-8 text-base", - lg: "md:w-10 md:h-10 md:text-xl text-base", + md: "md:w-10 md:h-10 text-lg", + lg: "md:w-12 md:h-12 md:text-2xl text-lg", } const nameSizes = { sm: "md:text-lg", - md: "md:text-lg", - lg: "md:text-xl", + md: "md:text-xl", + lg: "md:text-2xl", } return (
-
+
{`${username}'s
{position}
@@ -65,7 +80,7 @@ export function ContributorOverview({
-
{stats.stars}
+
{stats.stars}
-
+
{STATS_CONFIG.map((stat) => { const Icon = stat.icon return ( -
- +
+ {stat.getValue(stats)}
) })}
-
+
{Object.values(CONTRIBUTION_TYPES).map((type) => (
{type.emoji} {stats[type.value] || 0}
@@ -129,47 +144,89 @@ export function ContributorOverview({ return (
-

- 🏆 Top 3 Contributors 🏆 -

- - {/* Podium */} -
- {/* Second Place */} - {podiumContributors[1] && ( -
- onSelectContributor(podiumContributors[1][0])} - /> +
+ {fullTimerContributors.length > 0 && ( +
+

Full-time

+
+ {fullTimerContributors.map(([username, stats]) => ( +
onSelectContributor(username)} + className="bg-white rounded-lg shadow-sm p-3 cursor-pointer hover:shadow-md transition-shadow" + > +
+ {`${username}'s +
+ +
+ Score: {stats.score || 0} +
+
+
+
+ ))} +
)} +
+

+ 🏆 Top 3 Contributors 🏆 +

+ + {/* Podium */} +
+ {/* Second Place */} + {podiumContributors[1] && ( +
+ onSelectContributor(podiumContributors[1][0])} + /> +
+ )} + {/* First Place */} - {podiumContributors[0] && ( -
- onSelectContributor(podiumContributors[0][0])} - /> -
- )} + {podiumContributors[0] && ( +
+ onSelectContributor(podiumContributors[0][0])} + /> +
+ )} {/* Third Place */} - {podiumContributors[2] && ( -
- onSelectContributor(podiumContributors[2][0])} - /> + {podiumContributors[2] && ( +
+ onSelectContributor(podiumContributors[2][0])} + /> +
+ )}
- )} +
{/* Show All Contributors Button */} From e86ebb354d7bdb1dd9100281f3234fe8a08ae1cd Mon Sep 17 00:00:00 2001 From: Ayush Jhawar Date: Thu, 13 Feb 2025 22:29:39 +0530 Subject: [PATCH 2/6] all stats --- .../src/components/ContributorOverview.tsx | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/ContributorOverview.tsx b/frontend/src/components/ContributorOverview.tsx index 3553f5d..bd12e97 100644 --- a/frontend/src/components/ContributorOverview.tsx +++ b/frontend/src/components/ContributorOverview.tsx @@ -161,7 +161,7 @@ export function ContributorOverview({ alt={`${username}'s avatar`} className="w-10 h-10 rounded-full" /> -
From 8da4aed6f7a6fed9090ad338dcfc483f43d4b2b0 Mon Sep 17 00:00:00 2001 From: Ayush Jhawar Date: Thu, 13 Feb 2025 22:58:45 +0530 Subject: [PATCH 3/6] fix layout and stat for full timer --- .../src/components/ContributorOverview.tsx | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/frontend/src/components/ContributorOverview.tsx b/frontend/src/components/ContributorOverview.tsx index bd12e97..e562d69 100644 --- a/frontend/src/components/ContributorOverview.tsx +++ b/frontend/src/components/ContributorOverview.tsx @@ -155,14 +155,17 @@ export function ContributorOverview({ onClick={() => onSelectContributor(username)} className="bg-white rounded-lg shadow-sm p-3 cursor-pointer hover:shadow-md transition-shadow" > -
- {`${username}'s -
-
+
+
+ {`${username}'s +
+ +
+ -
- Score: {stats.score || 0} +
+ {stats.stars}
-
+
{STATS_CONFIG.map((stat) => { const Icon = stat.icon return ( -
- +
+ {stat.getValue(stats)}
) @@ -208,7 +214,7 @@ export function ContributorOverview({

🏆 Top 3 Contributors 🏆

- + {/* Podium */}
{/* Second Place */} @@ -223,7 +229,7 @@ export function ContributorOverview({
)} - {/* First Place */} + {/* First Place */} {podiumContributors[0] && (
)} - {/* Third Place */} + {/* Third Place */} {podiumContributors[2] && (
Date: Sat, 15 Feb 2025 22:10:30 +0530 Subject: [PATCH 4/6] create constant --- frontend/src/components/ContributorOverview.tsx | 11 +++++------ frontend/src/constants/contributors.ts | 1 + 2 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 frontend/src/constants/contributors.ts diff --git a/frontend/src/components/ContributorOverview.tsx b/frontend/src/components/ContributorOverview.tsx index e562d69..c733170 100644 --- a/frontend/src/components/ContributorOverview.tsx +++ b/frontend/src/components/ContributorOverview.tsx @@ -8,8 +8,7 @@ import { import { ContributorCard } from "./ContributorCard" import { getAvatarUrl, getProfileUrl } from "../constants/github" import { CONTRIBUTION_TYPES, STATS_CONFIG } from "../constants/metrics" - -const FULL_TIMERS = ["seveibar", "imrishabh18"] +import { FULL_TIMERS } from "../constants/contributors" export function ContributorOverview({ contributors, @@ -25,14 +24,14 @@ export function ContributorOverview({ } return [full, [...other, contributor]] }, - [[] as [string, ContributorStats][], [] as [string, ContributorStats][]] + [[] as [string, ContributorStats][], [] as [string, ContributorStats][]], ) // Get top 3 contributors from non-full-timers const podiumContributors = otherContributors.slice(0, 3) - const remainingContributors = otherContributors.slice(3).filter( - ([username]) => !FULL_TIMERS.includes(username) - ) + const remainingContributors = otherContributors + .slice(3) + .filter(([username]) => !FULL_TIMERS.includes(username)) const PodiumEntry = ({ position, diff --git a/frontend/src/constants/contributors.ts b/frontend/src/constants/contributors.ts new file mode 100644 index 0000000..ecbba92 --- /dev/null +++ b/frontend/src/constants/contributors.ts @@ -0,0 +1 @@ +export const FULL_TIMERS = ["seveibar", "imrishabh18"] From f3001c9981eef4b395e710f70ca2fdc87050a991 Mon Sep 17 00:00:00 2001 From: Ayush Jhawar Date: Tue, 18 Feb 2025 23:52:11 +0530 Subject: [PATCH 5/6] fix layout --- .../src/components/ContributorOverview.tsx | 85 ++++++++++--------- 1 file changed, 43 insertions(+), 42 deletions(-) diff --git a/frontend/src/components/ContributorOverview.tsx b/frontend/src/components/ContributorOverview.tsx index c733170..aa6fe0d 100644 --- a/frontend/src/components/ContributorOverview.tsx +++ b/frontend/src/components/ContributorOverview.tsx @@ -154,53 +154,54 @@ export function ContributorOverview({ onClick={() => onSelectContributor(username)} className="bg-white rounded-lg shadow-sm p-3 cursor-pointer hover:shadow-md transition-shadow" > -
-
- {`${username}'s -
- -
-
- - {username} - +
+
+
+ {`${username}'s
-
- {stats.stars} -
-
- {STATS_CONFIG.map((stat) => { - const Icon = stat.icon - return ( -
- - {stat.getValue(stats)} -
- ) - })} +
+ +
+ {stats.stars} +
-
- {Object.values(CONTRIBUTION_TYPES).map((type) => ( +
+
+ {STATS_CONFIG.map((stat) => { + const Icon = stat.icon + return (
- {type.emoji} {stats[type.value] || 0} + + {stat.getValue(stats)}
- ))} -
+ ) + })} +
+
+ {Object.values(CONTRIBUTION_TYPES).map((type) => ( +
+ {type.emoji} {stats[type.value] || 0} +
+ ))}
From 7f40a97ea0a358f4f85eb5767e5eaf826d93891e Mon Sep 17 00:00:00 2001 From: Ayush Jhawar Date: Wed, 19 Feb 2025 14:22:47 +0530 Subject: [PATCH 6/6] fix size of full timer --- frontend/src/components/ContributorOverview.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/ContributorOverview.tsx b/frontend/src/components/ContributorOverview.tsx index aa6fe0d..7744c3a 100644 --- a/frontend/src/components/ContributorOverview.tsx +++ b/frontend/src/components/ContributorOverview.tsx @@ -145,7 +145,7 @@ export function ContributorOverview({
{fullTimerContributors.length > 0 && ( -
+

Full-time

{fullTimerContributors.map(([username, stats]) => ( @@ -155,12 +155,12 @@ export function ContributorOverview({ className="bg-white rounded-lg shadow-sm p-3 cursor-pointer hover:shadow-md transition-shadow" >
-
+
{`${username}'s
@@ -174,18 +174,18 @@ export function ContributorOverview({ {username}
-
+
{stats.stars}
-
+
{STATS_CONFIG.map((stat) => { const Icon = stat.icon return (
{stat.getValue(stats)} @@ -193,7 +193,7 @@ export function ContributorOverview({ ) })}
-
+
{Object.values(CONTRIBUTION_TYPES).map((type) => (