import type { PlayerScore, RoomSnapshot } from "@nerdware/shared" interface ScoreboardProps { scores: PlayerScore[] snapshot: RoomSnapshot playerId: string | null } export function Scoreboard({ scores, snapshot, playerId }: ScoreboardProps) { const nameOf = (id: string) => snapshot.players.find((p) => p.id === id)?.name ?? "?" const ranked = [...scores].sort((a, b) => b.score - a.score) return (
    {ranked.map((s, i) => (
  1. {i + 1} {nameOf(s.playerId)} {s.playerId === playerId && ( (toi) )} {s.score}
  2. ))}
) }