import { type JSX } from 'react'; import { useAppStore } from '../../store'; import { uiStrings } from '../../content'; import { bootstrapAudioContext } from './use-audio-bootstrap'; /** * D-21 + AEST-07: tasteful typographic Begin screen. Phase 3 swaps in * the painted gesture-gate without changing this file's behavior. * * D-22: shown on first run only — gated by session.beginGateDismissed. * Once dismissed, the gate stays down for the session; persistence * across sessions is owned by the save lifecycle (Plan 02-05). * * CLAUDE.md banner concern #7 (Web Audio user-gesture): the click * handler calls `bootstrapAudioContext()` SYNCHRONOUSLY (not inside a * useEffect), so iOS Safari sees the AudioContext construction inside * the gesture (Pitfall 5). */ export function BeginScreen(): JSX.Element | null { const dismissed = useAppStore((s) => s.beginGateDismissed); const dismissBeginGate = useAppStore((s) => s.dismissBeginGate); if (dismissed) return null; const strings = uiStrings[1]?.begin; if (!strings) return null; const onBegin = (): void => { void bootstrapAudioContext(); // synchronous-inside-click; do NOT move into useEffect (Pitfall 5) dismissBeginGate(); }; return (
{strings.subtitle}