From c3152058ce4f6a22ce0b21f0072315e30745ef80 Mon Sep 17 00:00:00 2001 From: jessy-david-dev Date: Sat, 11 Apr 2026 22:08:56 +0200 Subject: [PATCH] feat(multi): display player paths in round results screen --- app/api/rooms/[code]/route.ts | 4 ++++ app/api/rooms/route.ts | 2 ++ app/components/GameScreen.tsx | 30 ++++++++++++++++++++++++------ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/app/api/rooms/[code]/route.ts b/app/api/rooms/[code]/route.ts index 179aaca..462271d 100644 --- a/app/api/rooms/[code]/route.ts +++ b/app/api/rooms/[code]/route.ts @@ -146,6 +146,7 @@ export async function PATCH( name: playerName.trim().slice(0, 20), score: 0, currentArticle: "", + path: [], hasWon: false, hasSurrendered: false, isHost: false, @@ -203,6 +204,7 @@ export async function PATCH( // Reset etat joueurs pour cette manche for (const p of room.players) { p.currentArticle = startArticle; + p.path = [startArticle]; p.hasWon = false; p.hasSurrendered = false; } @@ -239,6 +241,8 @@ export async function PATCH( return Response.json({ error: "Article invalide" }, { status: 400 }); } player.currentArticle = article; + if (!player.path) player.path = []; + player.path.push(article); player.lastSeen = Date.now(); const normalize = (s: string) => diff --git a/app/api/rooms/route.ts b/app/api/rooms/route.ts index dea0a2d..9cc4cb1 100644 --- a/app/api/rooms/route.ts +++ b/app/api/rooms/route.ts @@ -11,6 +11,7 @@ export type Player = { name: string; score: number; currentArticle: string; + path: string[]; // articles visités cette manche hasWon: boolean; hasSurrendered: boolean; isHost: boolean; @@ -141,6 +142,7 @@ export async function POST(request: NextRequest) { name: playerName.trim().slice(0, 20), score: 0, currentArticle: "", + path: [], hasWon: false, hasSurrendered: false, isHost: true, diff --git a/app/components/GameScreen.tsx b/app/components/GameScreen.tsx index da59993..4d3ff10 100644 --- a/app/components/GameScreen.tsx +++ b/app/components/GameScreen.tsx @@ -66,12 +66,30 @@ export function GameScreen({

Classement