From f0bcb6084a969eb7bd1822bbd20187c354e2642c Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Mon, 21 Sep 2026 16:21:40 +0700 Subject: [PATCH] refactor(web): extract ArmedButton for the three press-twice controls Resign, claim-dead-end and kick each duplicated the same arm/disarm timer and disarm-on-disable effect. ArmedButton.svelte owns that once, plus the a11y gap none of the three closed: aria-pressed carries the armed state to assistive tech, since a screen reader announces a control's name on focus, not on the in-place label swap the first press used to be silent about. Kick arms per seat now rather than sharing one Lobby-level slot, which was an implementation detail of the old shared state rather than a stated rule. --- web/src/lib/components/ArmedButton.svelte | 84 +++++++++++++++++ web/src/lib/components/GameBoard.svelte | 108 +++++----------------- web/src/lib/components/Lobby.svelte | 47 +++------- 3 files changed, 121 insertions(+), 118 deletions(-) create mode 100644 web/src/lib/components/ArmedButton.svelte diff --git a/web/src/lib/components/ArmedButton.svelte b/web/src/lib/components/ArmedButton.svelte new file mode 100644 index 0000000..cc4be46 --- /dev/null +++ b/web/src/lib/components/ArmedButton.svelte @@ -0,0 +1,84 @@ + + + diff --git a/web/src/lib/components/GameBoard.svelte b/web/src/lib/components/GameBoard.svelte index 9e7fae9..a7ffa83 100644 --- a/web/src/lib/components/GameBoard.svelte +++ b/web/src/lib/components/GameBoard.svelte @@ -1,4 +1,5 @@
@@ -237,15 +175,13 @@ the current syllable, which only means something on this player's own turn — unlike resign, there is no "not yet" state worth showing for it off turn. --> - + onconfirm={onclaimdeadend} + /> {/if} {#if game.state.claimError}