diff --git a/electron/renderer/components/sidebar/characters/sidebar-item-characters.tsx b/electron/renderer/components/sidebar/characters/sidebar-item-characters.tsx index cd5e69c5..6096ec9d 100644 --- a/electron/renderer/components/sidebar/characters/sidebar-item-characters.tsx +++ b/electron/renderer/components/sidebar/characters/sidebar-item-characters.tsx @@ -78,7 +78,6 @@ export const SidebarItemCharacters: React.FC = (): ReactNode => { closeModals(); setCharacter(character); await playCharacter(character); - // TODO navigate to game grid so user can play the character }); }, [closeModals, playCharacter] diff --git a/electron/renderer/components/sidebar/sidebar.tsx b/electron/renderer/components/sidebar/sidebar.tsx index 699fe0cc..438e934d 100644 --- a/electron/renderer/components/sidebar/sidebar.tsx +++ b/electron/renderer/components/sidebar/sidebar.tsx @@ -20,6 +20,10 @@ export const Sidebar: React.FC = (): ReactNode => { setShowSettings(false); }, []); + useSubscribe(['sidebar:hide'], () => { + closeSidebar(); + }); + useSubscribe(['sidebar:show'], (sidebarId: SidebarId) => { closeSidebar(); switch (sidebarId) { diff --git a/electron/renderer/context/game.tsx b/electron/renderer/context/game.tsx index 2076e72c..df217b1d 100644 --- a/electron/renderer/context/game.tsx +++ b/electron/renderer/context/game.tsx @@ -10,7 +10,7 @@ import type { } from '../../common/game/types.js'; import { useQuitCharacter } from '../hooks/characters.jsx'; import { useLogger } from '../hooks/logger.jsx'; -import { useSubscribe } from '../hooks/pubsub.jsx'; +import { usePubSub, useSubscribe } from '../hooks/pubsub.jsx'; import { runInBackground } from '../lib/async/run-in-background.js'; /** @@ -39,6 +39,7 @@ export const GameProvider: React.FC = ( const logger = useLogger('context:game'); const router = useRouter(); + const pubsub = usePubSub(); const quitCharacter = useQuitCharacter(); @@ -62,6 +63,7 @@ export const GameProvider: React.FC = ( useSubscribe(['character:play:started'], async () => { setShowPlayStartingOverlay(false); + pubsub.publish('sidebar:hide'); await router.push('/grid'); });