feat(ui): single-word rule indicators + auto-match select redesign
CI / changes (pull_request) Successful in 1s
CI / unit (pull_request) Successful in 9s
CI / integration (pull_request) Successful in 13s
CI / ui (pull_request) Successful in 46s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m9s
CI / changes (pull_request) Successful in 1s
CI / unit (pull_request) Successful in 9s
CI / integration (pull_request) Successful in 13s
CI / ui (pull_request) Successful in 46s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m9s
Surface the per-game "single word" rule to the client and refine the random-opponent New Game screen. - Wire: thread multiple_words_per_turn into the GameView and Invitation FlatBuffers tables (Go + TS regenerated), through pkg/wire builders and both the backend push-event and gateway REST paths. - In-game indicators (single-word games only): a small 1 in the status bar's score-preview slot (yields to the live preview) and a centred "One word per turn" label in the history-drawer header. Standard games show neither. - Invitation card gains a "One word per turn" line for single-word invitations. - Auto-match redesign: variant plaques are mutually-exclusive selects (highlight on tap, no longer enqueue); a lone offered variant is pre-selected; a bottom "Start game" button (disabled until a variant is chosen) confirms. The rule toggle appears once a Russian variant is selected. - Tests: e2e for the new auto flow and the in-game indicator (mock g3 is a single-word game); mock/data + fixtures carry the new field. Docs: UI_DESIGN.
This commit is contained in:
@@ -24,7 +24,12 @@
|
||||
// "Multiple words per turn" off is the single-word rule; it is offered for Russian games
|
||||
// only (English is always standard and shows no toggle). Shared by both flows.
|
||||
let multipleWords = $state(false);
|
||||
const autoHasRussian = $derived(variants.some((v) => supportsMultipleWordsToggle(v.id)));
|
||||
// Auto-match: the variant is a select (highlight, no immediate enqueue) confirmed by the
|
||||
// Start button. A lone offered variant is pre-selected; with several the player must pick.
|
||||
let selectedAuto = $state<Variant | ''>('');
|
||||
$effect(() => {
|
||||
if (variants.length === 1 && !selectedAuto) selectedAuto = variants[0].id;
|
||||
});
|
||||
const timeouts = [
|
||||
{ secs: 300, key: 'time.minutes' as MessageKey, n: 5 },
|
||||
{ secs: 1800, key: 'time.minutes' as MessageKey, n: 30 },
|
||||
@@ -182,15 +187,14 @@
|
||||
|
||||
{#if mode === 'auto'}
|
||||
<p class="subtitle">{t('new.subtitle')}</p>
|
||||
{#if autoHasRussian}
|
||||
<label class="toggle">
|
||||
<span>{t('new.multipleWordsPerTurn')}</span>
|
||||
<input type="checkbox" bind:checked={multipleWords} />
|
||||
</label>
|
||||
{/if}
|
||||
<div class="variants">
|
||||
{#each variants as v (v.id)}
|
||||
<button class="variant" onclick={() => find(v.id)} disabled={!connection.online}>
|
||||
<button
|
||||
class="variant"
|
||||
class:selected={selectedAuto === v.id}
|
||||
onclick={() => (selectedAuto = v.id)}
|
||||
disabled={!connection.online}
|
||||
>
|
||||
<span class="vmain">
|
||||
<span class="vname">{t(v.label)}</span>
|
||||
{#if VARIANT_FLAG[v.id]}
|
||||
@@ -203,7 +207,18 @@
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
{#if selectedAuto && supportsMultipleWordsToggle(selectedAuto)}
|
||||
<label class="toggle">
|
||||
<span>{t('new.multipleWordsPerTurn')}</span>
|
||||
<input type="checkbox" bind:checked={multipleWords} />
|
||||
</label>
|
||||
{/if}
|
||||
<p class="movelimit">{t('new.moveLimit', { n: AUTO_MATCH_HOURS })}</p>
|
||||
<button
|
||||
class="invite"
|
||||
disabled={!selectedAuto || !connection.online}
|
||||
onclick={() => selectedAuto && find(selectedAuto)}
|
||||
>{t('new.start')}</button>
|
||||
{:else if friends.length === 0}
|
||||
<p class="subtitle">{t('new.noFriends')}</p>
|
||||
{:else}
|
||||
@@ -310,6 +325,12 @@
|
||||
font-size: 0.8rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
/* Selected auto-match variant: an accent inset border (the button no longer enqueues on
|
||||
tap; the Start button confirms the choice). */
|
||||
.variant.selected {
|
||||
border-color: var(--accent);
|
||||
box-shadow: inset 0 0 0 2px var(--accent);
|
||||
}
|
||||
.movelimit {
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
|
||||
Reference in New Issue
Block a user