@@ -16,6 +16,9 @@ import "./leaderboard.css";
1616
1717const GITHUB_ORG = "recodehive" ;
1818
19+ // Users to exclude from the leaderboard
20+ const EXCLUDED_USERS = [ "sanjay-kv" , "allcontributors" , "allcontributors[bot]" ] ;
21+
1922interface Contributor {
2023 username : string ;
2124 avatar : string ;
@@ -71,9 +74,16 @@ export default function LeaderBoard(): JSX.Element {
7174 const [ currentPage , setCurrentPage ] = useState ( 1 ) ;
7275 const itemsPerPage = 10 ;
7376
74- const filteredContributors = contributors . filter ( ( contributor ) =>
75- contributor . username . toLowerCase ( ) . includes ( searchQuery . toLowerCase ( ) )
76- ) ;
77+ // Filter out excluded users and then apply search filter
78+ const filteredContributors = contributors
79+ . filter ( ( contributor ) =>
80+ ! EXCLUDED_USERS . some ( excludedUser =>
81+ contributor . username . toLowerCase ( ) === excludedUser . toLowerCase ( )
82+ )
83+ )
84+ . filter ( ( contributor ) =>
85+ contributor . username . toLowerCase ( ) . includes ( searchQuery . toLowerCase ( ) )
86+ ) ;
7787
7888 const totalPages = Math . ceil ( filteredContributors . length / itemsPerPage ) ;
7989 const indexOfLast = currentPage * itemsPerPage ;
@@ -122,13 +132,13 @@ export default function LeaderBoard(): JSX.Element {
122132 </ motion . div >
123133
124134 { /* Top 3 Performers Section */ }
125- { ! loading && ! error && contributors . length > 2 && (
135+ { ! loading && ! error && filteredContributors . length > 2 && (
126136 < div className = "top-performers-container" >
127137 < h2 className = { `top-performers-title ${ isDark ? "dark" : "light" } ` } > RecodeHive Top Performers</ h2 >
128138 < div className = "top-performers-grid" >
129- < TopPerformerCard contributor = { contributors [ 1 ] } rank = { 2 } />
130- < TopPerformerCard contributor = { contributors [ 0 ] } rank = { 1 } />
131- < TopPerformerCard contributor = { contributors [ 2 ] } rank = { 3 } />
139+ < TopPerformerCard contributor = { filteredContributors [ 1 ] } rank = { 2 } />
140+ < TopPerformerCard contributor = { filteredContributors [ 0 ] } rank = { 1 } />
141+ < TopPerformerCard contributor = { filteredContributors [ 2 ] } rank = { 3 } />
132142 </ div >
133143 </ div >
134144 ) }
0 commit comments