From 6ae12f48742e39cb286c5abbc8304ef414a59a81 Mon Sep 17 00:00:00 2001 From: aditya singh rathore Date: Thu, 9 Oct 2025 10:00:22 +0530 Subject: [PATCH] Fix the Spells on the dashboard Co-Authored-By: Sanjay Viswanathan --- .../dashboard/LeaderBoard/leaderboard.tsx | 126 ++++++++-------- src/pages/dashboard/index.tsx | 142 +++++++++--------- 2 files changed, 134 insertions(+), 134 deletions(-) diff --git a/src/components/dashboard/LeaderBoard/leaderboard.tsx b/src/components/dashboard/LeaderBoard/leaderboard.tsx index e4c105fe..2f1382b6 100644 --- a/src/components/dashboard/LeaderBoard/leaderboard.tsx +++ b/src/components/dashboard/LeaderBoard/leaderboard.tsx @@ -16,7 +16,7 @@ import PRListModal from "./PRListModal"; import { mockContributors } from "./mockData"; import "./leaderboard.css"; -const GITHUB_ORG = "recodehive"; +const GITHUB_ORG = "recodehive"; // Users to exclude from the leaderboard const EXCLUDED_USERS = ["sanjay-kv", "allcontributors", "allcontributors[bot]"]; @@ -44,15 +44,15 @@ interface Stats { flooredTotalPoints: number; } -function Badge({ - count, - label, - color, +function Badge({ + count, + label, + color, onClick, - clickable = false -}: { - count: number; - label: string; + clickable = false +}: { + count: number; + label: string; color: { background: string; color: string }; onClick?: () => void; clickable?: boolean; @@ -77,7 +77,7 @@ function Badge({ }; return ( - void; }) { const { colorMode } = useColorMode(); const isDark = colorMode === "dark"; const rankClass = rank === 1 ? "top-1" : rank === 2 ? "top-2" : "top-3"; - + return (
{contributor.username} @@ -115,9 +115,9 @@ function TopPerformerCard({ {contributor.username}
- onPRClick(contributor)} clickable={true} @@ -131,15 +131,15 @@ function TopPerformerCard({ export default function LeaderBoard(): JSX.Element { // Get time filter functions from context - const { - contributors, - stats, - loading, - error, - currentTimeFilter, - setTimeFilter + const { + contributors, + stats, + loading, + error, + currentTimeFilter, + setTimeFilter } = useCommunityStatsContext(); - + const { colorMode } = useColorMode(); const isDark = colorMode === "dark"; @@ -165,15 +165,15 @@ export default function LeaderBoard(): JSX.Element { const displayContributors = (error || contributors.length === 0) ? (typeof process !== "undefined" && process.env.NODE_ENV === "development" - ? mockContributors - : []) + ? mockContributors + : []) : contributors; // Filter out excluded users and apply search filter const filteredContributors = contributors - .filter((contributor) => - !EXCLUDED_USERS.some(excludedUser => + .filter((contributor) => + !EXCLUDED_USERS.some(excludedUser => contributor.username.toLowerCase() === excludedUser.toLowerCase() ) ) @@ -191,7 +191,7 @@ export default function LeaderBoard(): JSX.Element { const renderPaginationButtons = () => { const pages = []; const maxVisibleButtons = 5; // Maximum number of page buttons to show directly - + // Special case: if we have 7 or fewer pages, show all of them without ellipsis if (totalPages <= 7) { for (let i = 1; i <= totalPages; i++) { @@ -207,9 +207,9 @@ export default function LeaderBoard(): JSX.Element { } return pages; } - + // For more than 7 pages, use the ellipsis approach - + // Always show first page pages.push( ); } - + // Show ellipsis if needed after the middle range if (endPage < totalPages - 1) { pages.push( ... ); } - + // Always show last page pages.push(