'use client'; interface LeaderboardEntry { userId: number; userName: string | null; userEmail: string | null; totalAmount: number; orderCount: number; } interface LeaderboardProps { data: LeaderboardEntry[]; dark?: boolean; } const RANK_STYLES: Record = { 1: { light: 'bg-amber-100 text-amber-700', dark: 'bg-amber-500/20 text-amber-300' }, 2: { light: 'bg-slate-200 text-slate-600', dark: 'bg-slate-500/20 text-slate-300' }, 3: { light: 'bg-orange-100 text-orange-700', dark: 'bg-orange-500/20 text-orange-300' }, }; export default function Leaderboard({ data, dark }: LeaderboardProps) { const thCls = `px-4 py-3 text-left text-xs font-medium uppercase ${dark ? 'text-slate-400' : 'text-gray-500'}`; const tdCls = `whitespace-nowrap px-4 py-3 text-sm ${dark ? 'text-slate-300' : 'text-slate-700'}`; const tdMuted = `whitespace-nowrap px-4 py-3 text-sm ${dark ? 'text-slate-400' : 'text-gray-500'}`; if (data.length === 0) { return (

充值排行榜 (Top 10)

暂无数据

); } return (

充值排行榜 (Top 10)

{data.map((entry, i) => { const rank = i + 1; const rankStyle = RANK_STYLES[rank]; return ( ); })}
# 用户 累计金额 订单数
{rankStyle ? ( {rank} ) : ( {rank} )}
{entry.userName || `#${entry.userId}`}
{entry.userEmail && (
{entry.userEmail}
)}
¥{entry.totalAmount.toLocaleString()} {entry.orderCount}
); }