diff --git a/app/components/GameScreen.tsx b/app/components/GameScreen.tsx index 73f48bb..7712531 100644 --- a/app/components/GameScreen.tsx +++ b/app/components/GameScreen.tsx @@ -51,6 +51,13 @@ export function GameScreen({ }: GameScreenProps) { const breadcrumbEndRef = useRef(null); useCtrlFBlock(room.searchAllowed); + + function fmtMs(ms: number): string { + const s = Math.floor(ms / 1000); + const m = Math.floor(s / 60); + const sec = s % 60; + return m > 0 ? `${m}:${String(sec).padStart(2, "0")}` : `${sec}s`; + } const myPlayer = room.players.find((p) => p.id === playerId); const isHost = myPlayer?.isHost ?? false; const myFinished = myPlayer?.hasWon || myPlayer?.hasSurrendered; @@ -151,7 +158,11 @@ export function GameScreen({ ))} ({p.path.length - 1} clic - {p.path.length - 1 > 1 ? "s" : ""}) + {p.path.length - 1 > 1 ? "s" : ""} + {p.hasWon && p.wonAt && room.roundStart + ? ` ยท ${fmtMs(p.wonAt - room.roundStart)}` + : ""} + ) )}