diff --git a/apps/web/src/components/game-end-view.tsx b/apps/web/src/components/game-end-view.tsx index 0d8c8fe..fb85092 100644 --- a/apps/web/src/components/game-end-view.tsx +++ b/apps/web/src/components/game-end-view.tsx @@ -1,8 +1,9 @@ import { Link } from "wouter" +import { motion } from "framer-motion" +import { Crown } from "lucide-react" import type { PlayerScore, RoomSnapshot } from "@nerdware/shared" import { Button } from "@workspace/ui/components/button" import { useRoomStore } from "@/store/room" -import { Scoreboard } from "@/components/scoreboard" export function GameEndView({ snapshot }: { snapshot: RoomSnapshot }) { const playerId = useRoomStore((s) => s.playerId) @@ -10,9 +11,13 @@ export function GameEndView({ snapshot }: { snapshot: RoomSnapshot }) { const reset = useRoomStore((s) => s.reset) const scores: PlayerScore[] = finalScores ?? snapshot.scores - const winner = [...scores].sort((a, b) => b.score - a.score)[0] - const winnerName = - snapshot.players.find((p) => p.id === winner?.playerId)?.name ?? "?" + const ranked = [...scores].sort((a, b) => b.score - a.score) + const nameOf = (id: string) => + snapshot.players.find((p) => p.id === id)?.name ?? "?" + + const winner = ranked[0] + const rest = ranked.slice(1) + const isMe = (id: string) => id === playerId return (