From f10c67a5bad8171f18f9aa49017ac1a69512a5b2 Mon Sep 17 00:00:00 2001 From: Lukas Date: Fri, 27 Mar 2026 00:16:32 +0100 Subject: [PATCH] Dismiss side panel when encounter becomes empty Closes the stat block / source manager panel when the last combatant is removed or the encounter is cleared, giving a fully clean state. Co-Authored-By: Claude Opus 4.6 (1M context) --- apps/web/src/App.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/web/src/App.tsx b/apps/web/src/App.tsx index 1ad84a3..6d89735 100644 --- a/apps/web/src/App.tsx +++ b/apps/web/src/App.tsx @@ -30,6 +30,13 @@ export function App() { const activeRowRef = useRef(null); const actionBarAnim = useActionBarAnimation(encounter.combatants.length); + // Close the side panel when the encounter becomes empty + useEffect(() => { + if (isEmpty) { + sidePanel.dismissPanel(); + } + }, [isEmpty, sidePanel.dismissPanel]); + // Auto-scroll to active combatant when turn changes const activeIndex = encounter.activeIndex; useEffect(() => {