Preserve stat block panel collapsed state on turn advance
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -210,9 +210,9 @@ export function App() {
|
|||||||
encounter.combatants[encounter.activeIndex]?.creatureId;
|
encounter.combatants[encounter.activeIndex]?.creatureId;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (activeCreatureId && sidePanel.panelView.mode === "creature") {
|
if (activeCreatureId && sidePanel.panelView.mode === "creature") {
|
||||||
sidePanel.showCreature(activeCreatureId);
|
sidePanel.updateCreature(activeCreatureId);
|
||||||
}
|
}
|
||||||
}, [activeCreatureId, sidePanel.panelView.mode, sidePanel.showCreature]);
|
}, [activeCreatureId, sidePanel.panelView.mode, sidePanel.updateCreature]);
|
||||||
|
|
||||||
// Auto-scroll to the active combatant when the turn changes
|
// Auto-scroll to the active combatant when the turn changes
|
||||||
const activeRowRef = useRef<HTMLDivElement>(null);
|
const activeRowRef = useRef<HTMLDivElement>(null);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ interface SidePanelState {
|
|||||||
|
|
||||||
interface SidePanelActions {
|
interface SidePanelActions {
|
||||||
showCreature: (creatureId: CreatureId) => void;
|
showCreature: (creatureId: CreatureId) => void;
|
||||||
|
updateCreature: (creatureId: CreatureId) => void;
|
||||||
showBulkImport: () => void;
|
showBulkImport: () => void;
|
||||||
showSourceManager: () => void;
|
showSourceManager: () => void;
|
||||||
dismissPanel: () => void;
|
dismissPanel: () => void;
|
||||||
@@ -52,6 +53,10 @@ export function useSidePanelState(): SidePanelState & SidePanelActions {
|
|||||||
setIsRightPanelCollapsed(false);
|
setIsRightPanelCollapsed(false);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const updateCreature = useCallback((creatureId: CreatureId) => {
|
||||||
|
setPanelView({ mode: "creature", creatureId });
|
||||||
|
}, []);
|
||||||
|
|
||||||
const showBulkImport = useCallback(() => {
|
const showBulkImport = useCallback(() => {
|
||||||
setPanelView({ mode: "bulk-import" });
|
setPanelView({ mode: "bulk-import" });
|
||||||
setIsRightPanelCollapsed(false);
|
setIsRightPanelCollapsed(false);
|
||||||
@@ -91,6 +96,7 @@ export function useSidePanelState(): SidePanelState & SidePanelActions {
|
|||||||
pinnedCreatureId,
|
pinnedCreatureId,
|
||||||
isWideDesktop,
|
isWideDesktop,
|
||||||
showCreature,
|
showCreature,
|
||||||
|
updateCreature,
|
||||||
showBulkImport,
|
showBulkImport,
|
||||||
showSourceManager,
|
showSourceManager,
|
||||||
dismissPanel,
|
dismissPanel,
|
||||||
|
|||||||
Reference in New Issue
Block a user