From 4be5223ca8fc19a40c503a943c36f2e0f0165612 Mon Sep 17 00:00:00 2001 From: ginnoir Date: Thu, 11 Jun 2026 18:56:54 -0500 Subject: [PATCH] feat(ui): action queue list, cancel, disabled states, and hints --- src/ui/ActionPanel.tsx | 118 +++++++++++++++++++++++++++++++++-------- 1 file changed, 96 insertions(+), 22 deletions(-) diff --git a/src/ui/ActionPanel.tsx b/src/ui/ActionPanel.tsx index e306d7f..5dd2f37 100644 --- a/src/ui/ActionPanel.tsx +++ b/src/ui/ActionPanel.tsx @@ -1,38 +1,112 @@ -import { content } from '../content'; +import { useState } from 'react'; import { gameRuntime } from '../state/runtime'; import { useGameStore } from '../state/store'; -/** Action list — a start button per action, with a progress bar on the active one. */ +/** Action list with queue, cancel, disabled states, and story hints/tooltips. */ export function ActionPanel() { - const activeActionId = useGameStore((state) => state.activeActionId); - const actionProgress = useGameStore((state) => state.actionProgress); + const actions = useGameStore((s) => s.actions); + const activeActionId = useGameStore((s) => s.activeActionId); + const actionProgress = useGameStore((s) => s.actionProgress); + const queuedActionIds = useGameStore((s) => s.queuedActionIds); + const queuedActionNames = useGameStore((s) => s.queuedActionNames); + const prefs = useGameStore((s) => s.prefs); + const [openInfoId, setOpenInfoId] = useState(null); return (

Actions

- {content.actions.map((action) => { + {actions.map((action) => { const isActive = action.id === activeActionId; + const isDisabled = !action.available && !isActive; + const summaryParts = [ + action.costsSummary ? `Cost: ${action.costsSummary}` : null, + action.yieldsSummary ? `Yield: ${action.yieldsSummary}` : null, + ].filter(Boolean); + return ( - + {prefs.actionDetailMode === 'info-button' && action.storyTooltip ? ( +
+ + {openInfoId === action.id ? ( +
+ {action.storyTooltip} +
+ ) : null} +
) : null} -
- {action.name} - {isActive ? 'running…' : 'start'} -
- + ); })} + {queuedActionNames.length > 0 ? ( +
    + {queuedActionNames.map((name, index) => ( +
  1. + {name} + +
  2. + ))} +
+ ) : null}
); }