diff --git a/apps/web/src/components/game-end-view.tsx b/apps/web/src/components/game-end-view.tsx index daba468..1f2a5a4 100644 --- a/apps/web/src/components/game-end-view.tsx +++ b/apps/web/src/components/game-end-view.tsx @@ -147,6 +147,29 @@ export function GameEndView({ snapshot }: { snapshot: RoomSnapshot }) { } }, []) + const [copied, setCopied] = useState(false) + async function copyResults() { + const lines = ["NerdWare — Résultats", "", "🏆 Classement"] + ranked.forEach((s, i) => + lines.push(`${i + 1}. ${nameOf(s.playerId)} — ${s.score}`) + ) + if (gameRecap && gameRecap.length > 0) { + lines.push("", "Manches") + gameRecap.forEach((r) => + lines.push( + `${r.index + 1}. ${r.type === "blindtest" ? "🎧" : "🧠"} ${r.answer}` + ) + ) + } + try { + await navigator.clipboard.writeText(lines.join("\n")) + setCopied(true) + setTimeout(() => setCopied(false), 1500) + } catch { + // presse-papier indisponible : on ignore + } + } + const scores: PlayerScore[] = finalScores ?? snapshot.scores const ranked = [...scores].sort((a, b) => b.score - a.score) const nameOf = (id: string) => @@ -227,6 +250,10 @@ export function GameEndView({ snapshot }: { snapshot: RoomSnapshot }) { )} + {gameRecap && gameRecap.length > 0 && ( + + )} + {gameTracks && gameTracks.length > 0 && ( )} @@ -236,6 +263,10 @@ export function GameEndView({ snapshot }: { snapshot: RoomSnapshot }) { )}
+ {isHost ? (