Auto-open stat block panel when adding first bestiary creature

When the side panel is in its initial closed state (not user-collapsed),
adding a combatant from the bestiary now opens the panel to show its
stat block. This makes the panel discoverable without overriding a
deliberate collapse.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lukas
2026-03-17 12:03:34 +01:00
parent dfef2194a5
commit f024562a7d
3 changed files with 22 additions and 8 deletions

View File

@@ -128,9 +128,12 @@ export function App() {
const handleAddFromBestiary = useCallback(
(result: SearchResult) => {
addFromBestiary(result);
const creatureId = addFromBestiary(result);
if (creatureId && sidePanel.panelView.mode === "closed") {
sidePanel.showCreature(creatureId);
}
},
[addFromBestiary],
[addFromBestiary, sidePanel.panelView.mode, sidePanel.showCreature],
);
const handleCombatantStatBlock = useCallback(