import { useNavigate } from 'react-router-dom'; import type { PlayerInfo } from '../types'; import { computeTotal } from '../lib/standings'; import { leaveGame } from '../lib/leaveGame'; interface Props { players: PlayerInfo[]; standings: number[][][]; } export default function GameOver({ players, standings }: Props) { const navigate = useNavigate(); const totals = players .map((p) => ({ ...p, total: computeTotal(standings, p.order) })) .sort((a, b) => b.total - a.total); const handleLeave = () => leaveGame(navigate); const medals = ['🥇', '🥈', '🥉', '']; return (

Koniec hry

{totals.map((p, i) => (
{medals[i]} {p.name}
{p.total}
))}
); }