From ddf24e5714657cd2d9ab300e86fe62d51b2b3013 Mon Sep 17 00:00:00 2001 From: jessy-david-dev Date: Mon, 13 Apr 2026 15:59:34 +0200 Subject: [PATCH] feat(multi): display time for each player in round results --- app/components/GameScreen.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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)}` + : ""} + ) )}