import { lazy, Suspense } from 'react'; import type { BottomTab } from '../../hooks/useGameFlow'; import type { BattleRewardUi, CharacterChatUi, GoalFlowUi, InventoryFlowUi, QuestFlowUi, } from '../../hooks/useStoryGeneration'; import type { CompanionRenderState, GameState, StoryMoment, StoryOption } from '../../types'; import { getNineSliceStyle,TAB_ICONS, UI_CHROME } from '../../uiAssets'; import type { GameCanvasEntitySelection } from '../GameCanvas'; import { PixelIcon } from '../PixelIcon'; import { PanelLoadingFallback } from './GameShellLoaders'; import type { GameShellAdventureStatistics } from './types'; const AdventurePanel = lazy(async () => { const module = await import('../AdventurePanel'); return { default: module.AdventurePanel, }; }); const CharacterPanel = lazy(async () => { const module = await import('../CharacterPanel'); return { default: module.CharacterPanel, }; }); const InventoryPanel = lazy(async () => { const module = await import('../InventoryPanel'); return { default: module.InventoryPanel, }; }); export function GameShellStoryPanels({ visibleGameState, visibleCurrentStory, isLoading, aiError, bottomTab, setBottomTab, displayedOptions, hideStoryOptions, canRefreshOptions, handleRefreshOptions, handleSceneTransitionChoice, characterChatUi, inventoryUi, battleRewardUi, questUi, goalUi, companionRenderStates, characterChatSummaries, openOverlayPanel, openCampModal, openPartyMemberDetails, adventureStatistics, musicVolume, onMusicVolumeChange, onSaveAndExit, }: { visibleGameState: GameState; visibleCurrentStory: StoryMoment; isLoading: boolean; aiError: string | null; bottomTab: BottomTab; setBottomTab: (tab: BottomTab) => void; displayedOptions: StoryOption[]; hideStoryOptions: boolean; canRefreshOptions: boolean; handleRefreshOptions: () => void; handleSceneTransitionChoice: (option: StoryOption) => void; characterChatUi: CharacterChatUi; inventoryUi: InventoryFlowUi; battleRewardUi: BattleRewardUi; questUi: QuestFlowUi; goalUi: GoalFlowUi; companionRenderStates: CompanionRenderState[]; characterChatSummaries: Record; openOverlayPanel: (panel: 'character' | 'inventory') => void; openCampModal: () => void; openPartyMemberDetails: (selection: GameCanvasEntitySelection) => void; adventureStatistics: GameShellAdventureStatistics; musicVolume: number; onMusicVolumeChange: (value: number) => void; onSaveAndExit: () => void; }) { const playerCharacter = visibleGameState.playerCharacter; if (!playerCharacter) { return null; } return ( <>
{bottomTab === 'character' && ( }> )} {bottomTab === 'adventure' && ( }> openOverlayPanel('character')} onOpenInventory={() => openOverlayPanel('inventory')} playerCharacter={playerCharacter} worldType={visibleGameState.worldType} quests={visibleGameState.quests} questUi={questUi} goalStack={goalUi.goalStack} goalPulse={goalUi.pulse} onDismissGoalPulse={goalUi.dismissPulse} battleRewardUi={battleRewardUi} playerHp={visibleGameState.playerHp} playerMaxHp={visibleGameState.playerMaxHp} playerMana={visibleGameState.playerMana} playerMaxMana={visibleGameState.playerMaxMana} playerSkillCooldowns={visibleGameState.playerSkillCooldowns} inBattle={visibleGameState.inBattle} currentNpcBattleMode={visibleGameState.currentNpcBattleMode} chapterState={visibleGameState.chapterState ?? null} journeyBeat={ visibleGameState.storyEngineMemory?.currentJourneyBeat ?? null } statistics={adventureStatistics} musicVolume={musicVolume} onMusicVolumeChange={onMusicVolumeChange} onSaveAndExit={onSaveAndExit} /> )} {bottomTab === 'inventory' && ( }> )} ); }