feat(multi): display player paths in round results screen
This commit is contained in:
@@ -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) =>
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user