import { AnimatePresence, motion } from 'motion/react'; import { lazy, Suspense } from 'react'; import type { CharacterChatUi, InventoryFlowUi, StoryGenerationNpcUi, } from '../../hooks/useStoryGeneration'; import type { CompanionRenderState, GameState } from '../../types'; import { CHROME_ICONS, getNineSliceStyle, UI_CHROME } from '../../uiAssets'; import type { GameCanvasEntitySelection } from '../GameCanvas'; import { PixelIcon } from '../PixelIcon'; import { ModalLoadingFallback, PanelLoadingFallback } from './GameShellLoaders'; const AdventureEntityModal = lazy(async () => { const module = await import('../AdventureEntityModal'); return { default: module.AdventureEntityModal, }; }); const CharacterChatModal = lazy(async () => { const module = await import('../CharacterChatModal'); return { default: module.CharacterChatModal, }; }); const CompanionCampModal = lazy(async () => { const module = await import('../CompanionCampModal'); return { default: module.CompanionCampModal, }; }); const MapModal = lazy(async () => { const module = await import('../MapModal'); return { default: module.MapModal, }; }); const NpcModals = lazy(async () => { const module = await import('../NpcModals'); return { default: module.NpcModals, }; }); 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 GameShellOverlays({ gameState, isLoading, isMapOpen, setIsMapOpen, npcUi, characterChatUi, inventoryUi, companionRenderStates, characterChatSummaries, overlayPanel, closeOverlayPanel, openCampModal, openPartyMemberDetails, shouldMountAdventureEntityModal, selectedSceneEntity, closeAdventureEntityModal, shouldMountCampModal, showTeamModal, closeCampModal, onBenchCompanion, onActivateRosterCompanion, shouldMountMapModal, handleMapTravelToScene, shouldMountCharacterChatModal, shouldMountNpcModals, }: { gameState: GameState; isLoading: boolean; isMapOpen: boolean; setIsMapOpen: (open: boolean) => void; npcUi: StoryGenerationNpcUi; characterChatUi: CharacterChatUi; inventoryUi: InventoryFlowUi; companionRenderStates: CompanionRenderState[]; characterChatSummaries: Record; overlayPanel: 'character' | 'inventory' | null; closeOverlayPanel: () => void; openCampModal: () => void; openPartyMemberDetails: (selection: GameCanvasEntitySelection) => void; shouldMountAdventureEntityModal: boolean; selectedSceneEntity: GameCanvasEntitySelection | null; closeAdventureEntityModal: () => void; shouldMountCampModal: boolean; showTeamModal: boolean; closeCampModal: () => void; onBenchCompanion: (npcId: string) => void; onActivateRosterCompanion: (npcId: string, swapNpcId?: string | null) => void; shouldMountMapModal: boolean; handleMapTravelToScene: (sceneId: string) => boolean; shouldMountCharacterChatModal: boolean; shouldMountNpcModals: boolean; }) { return ( <> {shouldMountAdventureEntityModal && ( } > )} {overlayPanel && gameState.playerCharacter && ( event.stopPropagation()} >
{overlayPanel === 'character' ? '队伍' : '背包'}
{overlayPanel === 'character' ? ( } > { closeOverlayPanel(); openCampModal(); }} onOpenCharacterChat={(target) => { closeOverlayPanel(); characterChatUi.openChat(target); }} chatSummaries={characterChatSummaries} onInspectMember={openPartyMemberDetails} /> ) : ( } > )}
)}
{shouldMountCampModal && ( } > )} {shouldMountMapModal && ( setIsMapOpen(false)} /> } > { const triggered = handleMapTravelToScene(scene.id); if (triggered) { setIsMapOpen(false); } }} isTraveling={isLoading} onClose={() => setIsMapOpen(false)} /> )} {shouldMountCharacterChatModal && ( } > )} {shouldMountNpcModals && ( } > )} ); }