Unify the action bar into a single search input with inline bestiary dropdown. Clicking a dropdown entry queues it with +/- count controls and a confirm button; Enter or confirm adds N copies to combat. When no bestiary match exists, optional Init/AC/MaxHP fields appear for custom creatures. The eye icon opens a separate search dropdown to preview stat blocks without leaving the add flow. Fix batch-add bug where only the last creature got a creatureId by using store.save() instead of setEncounter() in addFromBestiary. Prevent dropdown buttons from stealing input focus so Enter confirms the queued batch. Remove the now-redundant BestiarySearch component. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2.1 KiB
Quickstart: Bottom Bar Overhaul
Key Files to Modify
| File | Purpose |
|---|---|
apps/web/src/components/action-bar.tsx |
Primary target: overhaul with batch queue, custom fields, stat block button |
apps/web/src/hooks/use-encounter.ts |
Extend addCombatant to accept optional fields (initiative, AC, maxHp) |
apps/web/src/App.tsx |
Wire stat block view callback to action bar |
apps/web/src/components/bestiary-search.tsx |
Likely removable after merging into unified action bar flow |
Key Files to Read (context)
| File | Why |
|---|---|
packages/domain/src/types.ts |
Combatant type definition |
packages/domain/src/add-combatant.ts |
Domain add function (not modified, but understand contract) |
packages/domain/src/auto-number.ts |
Name deduplication logic for batch adds |
apps/web/src/hooks/use-bestiary.ts |
SearchResult type, search function |
apps/web/src/components/stat-block-panel.tsx |
Stat block panel for viewer integration |
Implementation Approach
-
Batch add: Add
QueuedCreaturestate ({ result, count } | null) to action bar. On dropdown entry click: if same entry, increment count; if different, replace. On confirm/Enter, loopaddFromBestiary(result)N times. -
Custom fields: When
suggestions.length === 0and query is non-empty, show initiative/AC/maxHP inputs. ExtendonAddCombatantto accept optional stats object. Inuse-encounter.ts, patch the new combatant with provided values after creation. -
Stat block viewer: Accept
onViewStatBlock(result: SearchResult)prop. Repurpose the search button icon to trigger it with the currently highlighted dropdown entry. Wire in App.tsx to deriveCreatureIdand open stat block panel. -
Unified flow: Remove
searchOpentoggle state. The input field always shows bestiary suggestions inline. Remove or deprecateBestiarySearchcomponent.
Development Commands
pnpm --filter web dev # Dev server at localhost:5173
pnpm test # Run all tests
pnpm check # Full merge gate (must pass before commit)
pnpm vitest run <file> # Run single test file