import { formatCash } from '@/lib/format'; import type { PlayerSummary } from '@/lib/game/state'; // v1.6.0 (ISS-115): leaderboard panel — every player in the world with cash, reputation and // plane count, rendered straight off the shared snapshot (no endpoint of its own). Sorted by // reputation desc; cash then username break ties deterministically so rows don't shuffle // between snapshots when two players share a reputation. export default function Leaderboard({ players }: { players: PlayerSummary[] }) { const sorted = [...players].sort( (a, b) => b.reputation - a.reputation || b.cash - a.cash || a.username.localeCompare(b.username), ); return (
| Player | Cash | Reputation | Planes |
|---|---|---|---|
| {p.username} | {formatCash(p.cash)} | {p.reputation} | {p.planeCount} |