[ui] ChairSunset: Move the chair, half a minute of sunset with nothing to press, then the real one's time

This commit is contained in:
2026-11-02 07:35:30 +01:00
parent a99dfe535d
commit 7a6cf4c6d1
4 changed files with 342 additions and 0 deletions
+14
View File
@@ -6,6 +6,7 @@
import { parseLetter } from './letter/parse.js';
import Rose from './rose/Rose.svelte';
import type { RoseWiring } from './rose/types.js';
import ChairSunset from './sunset/ChairSunset.svelte';
import SunsetLine from './sunset/SunsetLine.svelte';
import SunsetPlace from './sunset/SunsetPlace.svelte';
import type { SunsetChoice, SunsetWiring } from './sunset/types.js';
@@ -37,6 +38,15 @@
let kept = $state(true);
let now = $state(0);
let sunLine = $state<HTMLElement>();
/** The in-game sunset is showing (chair-sunset.md). */
let watching = $state(false);
let chairButton = $state<HTMLButtonElement>();
async function stopWatching(): Promise<void> {
watching = false;
await tick();
chairButton?.focus();
}
const place = $derived(choice?.kind === 'town' ? choice.town : (sunset?.guess ?? null));
// One zone for the sunset and the rose's days: the chosen town's, else the device's (rose.md R8).
@@ -141,7 +151,11 @@
<p class="hint">{en.sunset.notKept}</p>
{/if}
<button type="button" class="quiet" onclick={() => (changing = true)}>{place ? en.sunset.change : en.sunset.choose}</button>
<button type="button" class="quiet" bind:this={chairButton} onclick={() => (watching = true)}>{en.chair.move}</button>
</div>
{#if watching}
<ChairSunset {place} guessed={choice?.kind === 'device-zone'} now={sunset.now} onclose={stopWatching} />
{/if}
{/if}
{#if blocks.length > 0}
<a href={LETTER_HASH}>{en.letter.title}</a>