import { lazy, Suspense, useEffect } from 'react'; import { UI_CHROME } from '../../uiAssets'; import { useAuthUi } from '../auth/AuthUiContext'; import { GameShellMainContent } from './GameShellMainContent'; import type { GameShellProps } from './types'; import { useGameShellRuntimeViewModel } from './useGameShellRuntimeViewModel'; const GameShellOverlays = lazy(async () => { const module = await import('./GameShellOverlays'); return { default: module.GameShellOverlays, }; }); const GameShellCanvasStage = lazy(async () => { const module = await import('./GameShellCanvasStage'); return { default: module.GameShellCanvasStage, }; }); export function GameShellRuntime({session, story, entry, companions, audio}: GameShellProps) { const authUi = useAuthUi(); const { gameState, isLoading, aiError, bottomTab, setBottomTab, isMapOpen, setIsMapOpen, } = session; const { displayedOptions, canRefreshOptions, handleRefreshOptions, handleMapTravelToScene, npcUi, characterChatUi, inventoryUi, battleRewardUi, questUi, goalUi, } = story; const { hasSavedGame, savedSnapshot, handleContinueGame, handleStartNewGame, handleSaveAndExit, handleCustomWorldSelect, handleBackToWorldSelect, handleCharacterSelect, } = entry; const { companionRenderStates, onBenchCompanion, onActivateRosterCompanion, } = companions; const {musicVolume, onMusicVolumeChange} = audio; const { selectionStage, setSelectionStage, overlayPanel, openOverlayPanel, closeOverlayPanel, selectedSceneEntity, setSelectedSceneEntity, openPartyMemberDetails, closeAdventureEntityModal, showTeamModal, openCampModal, closeCampModal, resetForSaveAndExit, shouldMountAdventureEntityModal, shouldMountCampModal, shouldMountMapModal, shouldMountCharacterChatModal, shouldMountNpcModals, visibleGameState, visibleCurrentStory, sceneTransitionPhase, sceneTransitionToken, setSceneTransitionDurations, isCharacterSelectionStage, shouldHideStoryOptions, hideSelectionHero, dialogueIndicator, characterChatSummaries, canvasCompanionRenderStates, adventureStatistics, handleSceneTransitionChoice, } = useGameShellRuntimeViewModel({ session, story, companions, }); useEffect(() => { authUi?.setGlobalAccountActionsVisible(Boolean(gameState.playerCharacter)); return () => { authUi?.setGlobalAccountActionsVisible(true); }; }, [authUi, gameState.playerCharacter]); return (
); }