import { cn } from "@/lib/utils"; import { Item, ItemContent } from "@/components/ui/item"; export interface LeaderboardDisplayRow { rank: number; userId: number; name: string; points: number; entries: number; isCurrentUser: boolean; /** True for a trailing row inserted when the viewer is outside the top list. */ isOutsideTop?: boolean; } function rankClass(rank: number, isOutsideTop?: boolean): string { if (isOutsideTop) return "text-muted-foreground"; if (rank === 1) return "font-bold text-amber-400"; if (rank === 2) return "font-semibold text-slate-300"; if (rank === 3) return "font-semibold text-amber-700"; return "text-muted-foreground"; } /** Read-only contribution XP leaderboard table. */ export function ContributionLeaderboard({ rows, emptyLabel, }: { rows: LeaderboardDisplayRow[]; emptyLabel: string; }) { if (rows.length === 0) { return (

{emptyLabel}

); } return (
{rows.map((row) => ( ))}
# Operator Entries XP
{row.isOutsideTop ? "-" : row.rank} {row.name} {row.isCurrentUser && ( You )} {row.entries.toLocaleString()} {row.points.toLocaleString()}
); }