fix(ui): restore boot-intro continue and fix story tree a11y

Finding 1 (critical): atBootIntro was derived from tree.length === 0 in
StoryView.tsx, but buildStoryTree always returns all topology-root nodes,
so tree.length is always > 0 and the Continue button never rendered.
Fix: add atBootIntro: boolean to StoryView (viewModel), computed by
finding the boot-trigger node id without hardcoding the literal string,
then comparing to the current node. StoryView.tsx reads it from the store.
Also add a viewModel test covering both true and false cases.

Finding 2: onSelect in StoryView.tsx called useGameStore.getState()
directly, bypassing the runtime command layer. Fix: add
GameRuntime.selectStoryNode(id) and wire onSelect through gameRuntime.

Finding 3: aria-pressed on story tree nodes wrongly signals toggle-button
semantics. Fix: replace with aria-current={isSelected ? 'true' : undefined}.

Optional: hoist h-[calc(100dvh-6rem)] to SHELL_HEIGHT const in StoryView.tsx.
This commit is contained in:
ginnoir
2026-06-11 22:25:51 -05:00
parent 91348ed42f
commit 880abe5888
6 changed files with 68 additions and 9 deletions
+7
View File
@@ -71,6 +71,7 @@ export interface StoryTreeNodeView {
export interface StoryView {
currentProse: string | null;
atBootIntro: boolean;
choices: StoryChoiceView[];
tree: StoryTreeNodeView[];
}
@@ -215,8 +216,14 @@ export function toView(state: GameState, content: GameContent): GameView {
const availableChoices = getAvailableChoices(state, content);
const allChoices = node?.choices ?? [];
const bootEntryNodeId = content.storyNodes.find((n) =>
n.triggers?.some((t) => t.type === 'boot'),
)?.id;
const atBootIntro = node != null && node.id === bootEntryNodeId;
const story: StoryView = {
currentProse: node?.prose ?? null,
atBootIntro,
choices: allChoices.map((choice) => {
const available = availableChoices.some((c) => c.id === choice.id);
return {