From 9a43952ad129bfef9c8ea82ba90c578e3238419c Mon Sep 17 00:00:00 2001 From: Eric Wagoner Date: Tue, 27 Oct 2026 10:58:12 -0400 Subject: [PATCH] A table's tab says whose move it is, who is playing, or who won, in place of "a game" Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01CCLa2PaEeCj8njQZSWGqHx --- src/routes/join/[code]/+page.svelte | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/routes/join/[code]/+page.svelte b/src/routes/join/[code]/+page.svelte index 108f683..a39df36 100644 --- a/src/routes/join/[code]/+page.svelte +++ b/src/routes/join/[code]/+page.svelte @@ -30,6 +30,16 @@ const link = $derived(`${location.origin}/join/${roomId}`); const watching = $derived(room?.spectating ?? false); + /** The tab's title: whose move it is, or how the game stands, so a glance at the tab bar says whether it is your turn. */ + const title = $derived.by(() => { + const g = room?.state; + if (!room || !g) return `table ${roomId}`; + const seat = g.seats.find((id) => g.players[id].side === g.toMove); + const toMove = seat ? g.players[seat].name : g.toMove; + if (g.over) return g.over.winner === null ? 'a draw' : g.over.winner === room.me ? 'you win' : `${g.players[g.over.winner].name} wins`; + if (watching) return `${room.others.map((s) => s.name).join(' and ')}, ${toMove} to move`; + return seat === room.me ? 'your move' : `${toMove} to move`; + }); // Return to a held seat, or take a place in the gallery and offer one. A link from the keeper carries a seat: // it leaves the address bar at once, is kept only once the server takes it, and never replaces a seat that @@ -158,7 +168,7 @@ - Wyrm: a game + Wyrm: {title}