@@ -16,7 +16,7 @@ import PRListModal from "./PRListModal";
16
16
import { mockContributors } from "./mockData" ;
17
17
import "./leaderboard.css" ;
18
18
19
- const GITHUB_ORG = "recodehive" ;
19
+ const GITHUB_ORG = "recodehive" ;
20
20
21
21
// Users to exclude from the leaderboard
22
22
const EXCLUDED_USERS = [ "sanjay-kv" , "allcontributors" , "allcontributors[bot]" ] ;
@@ -44,15 +44,15 @@ interface Stats {
44
44
flooredTotalPoints : number ;
45
45
}
46
46
47
- function Badge ( {
48
- count,
49
- label,
50
- color,
47
+ function Badge ( {
48
+ count,
49
+ label,
50
+ color,
51
51
onClick,
52
- clickable = false
53
- } : {
54
- count : number ;
55
- label : string ;
52
+ clickable = false
53
+ } : {
54
+ count : number ;
55
+ label : string ;
56
56
color : { background : string ; color : string } ;
57
57
onClick ?: ( ) => void ;
58
58
clickable ?: boolean ;
@@ -77,7 +77,7 @@ function Badge({
77
77
} ;
78
78
79
79
return (
80
- < span
80
+ < span
81
81
className = { `badge ${ clickable ? 'clickable' : '' } ` }
82
82
style = { badgeStyle }
83
83
onClick = { handleClick }
@@ -91,19 +91,19 @@ function Badge({
91
91
) ;
92
92
}
93
93
94
- function TopPerformerCard ( {
95
- contributor,
96
- rank,
97
- onPRClick
98
- } : {
99
- contributor : Contributor ;
94
+ function TopPerformerCard ( {
95
+ contributor,
96
+ rank,
97
+ onPRClick
98
+ } : {
99
+ contributor : Contributor ;
100
100
rank : number ;
101
101
onPRClick : ( contributor : Contributor ) => void ;
102
102
} ) {
103
103
const { colorMode } = useColorMode ( ) ;
104
104
const isDark = colorMode === "dark" ;
105
105
const rankClass = rank === 1 ? "top-1" : rank === 2 ? "top-2" : "top-3" ;
106
-
106
+
107
107
return (
108
108
< div className = { `top-performer-card ${ isDark ? "dark" : "light" } ` } >
109
109
< img src = { contributor . avatar } alt = { contributor . username } className = "avatar large" />
@@ -115,9 +115,9 @@ function TopPerformerCard({
115
115
{ contributor . username }
116
116
</ a >
117
117
< div className = "badges-container" >
118
- < Badge
119
- count = { contributor . prs }
120
- label = "PRs"
118
+ < Badge
119
+ count = { contributor . prs }
120
+ label = "PRs"
121
121
color = { { background : "#dbeafe" , color : "#2563eb" } }
122
122
onClick = { ( ) => onPRClick ( contributor ) }
123
123
clickable = { true }
@@ -131,15 +131,15 @@ function TopPerformerCard({
131
131
132
132
export default function LeaderBoard ( ) : JSX . Element {
133
133
// Get time filter functions from context
134
- const {
135
- contributors,
136
- stats,
137
- loading,
138
- error,
139
- currentTimeFilter,
140
- setTimeFilter
134
+ const {
135
+ contributors,
136
+ stats,
137
+ loading,
138
+ error,
139
+ currentTimeFilter,
140
+ setTimeFilter
141
141
} = useCommunityStatsContext ( ) ;
142
-
142
+
143
143
const { colorMode } = useColorMode ( ) ;
144
144
const isDark = colorMode === "dark" ;
145
145
@@ -165,15 +165,15 @@ export default function LeaderBoard(): JSX.Element {
165
165
const displayContributors =
166
166
( error || contributors . length === 0 )
167
167
? ( typeof process !== "undefined" && process . env . NODE_ENV === "development"
168
- ? mockContributors
169
- : [ ] )
168
+ ? mockContributors
169
+ : [ ] )
170
170
: contributors ;
171
171
172
172
173
173
// Filter out excluded users and apply search filter
174
174
const filteredContributors = contributors
175
- . filter ( ( contributor ) =>
176
- ! EXCLUDED_USERS . some ( excludedUser =>
175
+ . filter ( ( contributor ) =>
176
+ ! EXCLUDED_USERS . some ( excludedUser =>
177
177
contributor . username . toLowerCase ( ) === excludedUser . toLowerCase ( )
178
178
)
179
179
)
@@ -191,7 +191,7 @@ export default function LeaderBoard(): JSX.Element {
191
191
const renderPaginationButtons = ( ) => {
192
192
const pages = [ ] ;
193
193
const maxVisibleButtons = 5 ; // Maximum number of page buttons to show directly
194
-
194
+
195
195
// Special case: if we have 7 or fewer pages, show all of them without ellipsis
196
196
if ( totalPages <= 7 ) {
197
197
for ( let i = 1 ; i <= totalPages ; i ++ ) {
@@ -207,9 +207,9 @@ export default function LeaderBoard(): JSX.Element {
207
207
}
208
208
return pages ;
209
209
}
210
-
210
+
211
211
// For more than 7 pages, use the ellipsis approach
212
-
212
+
213
213
// Always show first page
214
214
pages . push (
215
215
< button
@@ -220,12 +220,12 @@ export default function LeaderBoard(): JSX.Element {
220
220
1
221
221
</ button >
222
222
) ;
223
-
223
+
224
224
// Calculate the range of pages to show (middle section)
225
225
// We want to show current page and 1-2 pages before and after when possible
226
226
let startPage = Math . max ( 2 , currentPage - 1 ) ;
227
227
let endPage = Math . min ( totalPages - 1 , currentPage + 1 ) ;
228
-
228
+
229
229
// Adjust start and end page if we're near the beginning or end
230
230
if ( currentPage <= 3 ) {
231
231
// Near the beginning, show pages 2, 3, 4
@@ -236,14 +236,14 @@ export default function LeaderBoard(): JSX.Element {
236
236
endPage = totalPages - 1 ;
237
237
startPage = Math . max ( 2 , totalPages - 3 ) ;
238
238
}
239
-
239
+
240
240
// Show ellipsis if needed before the middle range
241
241
if ( startPage > 2 ) {
242
242
pages . push (
243
243
< span key = "ellipsis-1" className = "pagination-ellipsis" > ...</ span >
244
244
) ;
245
245
}
246
-
246
+
247
247
// Show pages in the middle range
248
248
for ( let i = startPage ; i <= endPage ; i ++ ) {
249
249
pages . push (
@@ -256,14 +256,14 @@ export default function LeaderBoard(): JSX.Element {
256
256
</ button >
257
257
) ;
258
258
}
259
-
259
+
260
260
// Show ellipsis if needed after the middle range
261
261
if ( endPage < totalPages - 1 ) {
262
262
pages . push (
263
263
< span key = "ellipsis-2" className = "pagination-ellipsis" > ...</ span >
264
264
) ;
265
265
}
266
-
266
+
267
267
// Always show last page
268
268
pages . push (
269
269
< button
@@ -274,7 +274,7 @@ export default function LeaderBoard(): JSX.Element {
274
274
{ totalPages }
275
275
</ button >
276
276
) ;
277
-
277
+
278
278
return pages ;
279
279
} ;
280
280
@@ -289,7 +289,7 @@ export default function LeaderBoard(): JSX.Element {
289
289
const getTimeFilterLabel = ( filter : string ) => {
290
290
switch ( filter ) {
291
291
case 'week' : return '📊 This Week' ;
292
- case 'month' : return '📆 This Month' ;
292
+ case 'month' : return '📆 This Month' ;
293
293
case 'year' : return '📅 This Year' ;
294
294
case 'all' : return '🏆 All Time' ;
295
295
default : return '🏆 All Time' ;
@@ -306,17 +306,17 @@ export default function LeaderBoard(): JSX.Element {
306
306
animate = { { opacity : 1 , y : 0 } }
307
307
transition = { { duration : 0.5 } }
308
308
>
309
- < h1 className = "title" > recode hive Leaderboard</ h1 >
309
+ < h1 className = "title" > Recode Hive Leaderboard</ h1 >
310
310
< p className = { `subtitle ${ isDark ? "dark" : "light" } ` } >
311
- Top contributors across the < strong > { GITHUB_ORG } </ strong > organization
311
+ Top contributors across the < strong > Recode Hive </ strong > organization
312
312
</ p >
313
313
</ motion . div >
314
314
315
315
{ /* Top 3 Performers Section */ }
316
316
{ ! loading && filteredContributors . length > 2 && (
317
317
< div className = "top-performers-container" >
318
318
< div className = "title-filter-container" >
319
- < h2 className = { `top-performers-title ${ isDark ? "dark" : "light" } ` } > recode hive Top Performers</ h2 >
319
+ < h2 className = { `top-performers-title ${ isDark ? "dark" : "light" } ` } > Recode Hive Top Performers</ h2 >
320
320
< div className = "time-filter-wrapper top-title-filter" >
321
321
< label htmlFor = "time-period-filter" className = "filter-label" > Time Period:</ label >
322
322
< select
@@ -440,11 +440,11 @@ export default function LeaderBoard(): JSX.Element {
440
440
{ ! loading && filteredContributors . length > 0 && (
441
441
< div className = { `contributors-container ${ isDark ? "dark" : "light" } ` } >
442
442
{ error && (
443
- < div className = "error-banner" style = { {
444
- padding : '12px' ,
445
- backgroundColor : isDark ? '#fee8e7' : '#fee8e7' ,
446
- color : '#dc2626' ,
447
- borderRadius : '8px' ,
443
+ < div className = "error-banner" style = { {
444
+ padding : '12px' ,
445
+ backgroundColor : isDark ? '#fee8e7' : '#fee8e7' ,
446
+ color : '#dc2626' ,
447
+ borderRadius : '8px' ,
448
448
marginBottom : '16px' ,
449
449
fontSize : '14px' ,
450
450
textAlign : 'center'
@@ -453,11 +453,11 @@ export default function LeaderBoard(): JSX.Element {
453
453
</ div >
454
454
) }
455
455
< div className = "contributors-header" >
456
- < div className = "contributor-cell rank" > Rank</ div >
457
- < div className = "contributor-cell avatar-cell" > Avatar</ div >
458
- < div className = "contributor-cell username-cell" > User</ div >
459
- < div className = "contributor-cell prs-cell" > PRs</ div >
460
- < div className = "contributor-cell points-cell" > Points</ div >
456
+ < div className = "contributor-cell rank" > Rank</ div >
457
+ < div className = "contributor-cell avatar-cell" > Avatar</ div >
458
+ < div className = "contributor-cell username-cell" > User</ div >
459
+ < div className = "contributor-cell prs-cell" > PRs</ div >
460
+ < div className = "contributor-cell points-cell" > Points</ div >
461
461
</ div >
462
462
{ currentItems . map ( ( contributor , index ) => (
463
463
< motion . div
@@ -480,14 +480,14 @@ export default function LeaderBoard(): JSX.Element {
480
480
/>
481
481
</ div >
482
482
< div className = "contributor-cell username-cell" >
483
- < a href = { contributor . profile } target = "_blank" rel = "noreferrer" className = { `username-link ${ isDark ? "dark" : "light" } ` } >
484
- { contributor . username }
485
- </ a >
483
+ < a href = { contributor . profile } target = "_blank" rel = "noreferrer" className = { `username-link ${ isDark ? "dark" : "light" } ` } >
484
+ { contributor . username }
485
+ </ a >
486
486
</ div >
487
487
< div className = "contributor-cell prs-cell" >
488
- < Badge
489
- count = { contributor . prs }
490
- label = "PRs"
488
+ < Badge
489
+ count = { contributor . prs }
490
+ label = "PRs"
491
491
color = { { background : "#dbeafe" , color : "#2563eb" } }
492
492
onClick = { ( ) => handlePRClick ( contributor ) }
493
493
clickable = { true }
@@ -523,7 +523,7 @@ export default function LeaderBoard(): JSX.Element {
523
523
</ button >
524
524
</ div >
525
525
) }
526
-
526
+
527
527
{ /* CTA Footer */ }
528
528
< div className = { `cta-footer ${ isDark ? "dark" : "light" } ` } >
529
529
< p className = { `cta-text ${ isDark ? "dark" : "light" } ` } > Want to get on this leaderboard?</ p >
0 commit comments