"use client"; interface LeaderboardEntry { rank: number; username: string; score: number; level: number; avatar?: string | null; } interface LeaderboardSectionProps { leaderboard: LeaderboardEntry[]; backgroundImage: string; } // Format number with consistent locale to avoid hydration mismatch const formatScore = (score: number): string => { return score.toLocaleString("en-US"); }; export default function LeaderboardSection({ leaderboard, backgroundImage, }: LeaderboardSectionProps) { return (
{/* Background Image */}
{/* Dark overlay for readability */}
{/* Content */}
{/* Title Section */}

LEADERBOARD

Top Players
{/* Leaderboard Table */}
{/* Header */}
Rank
Player
Score
Level
{/* Entries */}
{leaderboard.map((entry) => (
{/* Rank */}
{entry.rank}
{/* Player */}
{entry.avatar ? (
{entry.username}
) : (
{entry.username.charAt(0).toUpperCase()}
)} {entry.username} {entry.rank <= 3 && ( )}
{/* Score */}
{formatScore(entry.score)}
{/* Level */}
Lv.{entry.level}
))}
{/* Footer Info */}

Compete with players worldwide and climb the ranks!

Rankings update every hour

); }