import { BarChart3, Bookmark, History, Settings, X } from 'lucide-react'; import { createPortal } from 'react-dom'; import type { ProfileSaveArchiveSummary } from '../../../packages/shared/src/contracts/runtime'; import type { VisualNovelResultDraft, VisualNovelRunSnapshot, } from '../../../packages/shared/src/contracts/visualNovel'; import { VisualNovelAttributePanel } from './VisualNovelAttributePanel'; import { VisualNovelHistoryPanel } from './VisualNovelHistoryPanel'; import { VisualNovelSavePanel } from './VisualNovelSavePanel'; import { VisualNovelSettingsPanel } from './VisualNovelSettingsPanel'; export type VisualNovelRuntimePanelKind = | 'history' | 'save' | 'settings' | 'attributes'; type VisualNovelRuntimePanelProps = { kind: VisualNovelRuntimePanelKind; draft: VisualNovelResultDraft; run: VisualNovelRunSnapshot; isBusy?: boolean; isSaving?: boolean; isLoadingArchives?: boolean; resumingWorldKey?: string | null; saveArchives?: ProfileSaveArchiveSummary[]; onClose: () => void; onRegenerateHistoryEntry?: (entryId: string) => void; onSaveRun?: () => void; onResumeSaveArchive?: (worldKey: string) => void; textModeEnabled?: boolean; onTextModeChange?: (enabled: boolean) => void; allowRegeneration?: boolean; }; const PANEL_META: Record< VisualNovelRuntimePanelKind, { title: string; icon: typeof History } > = { history: { title: '历史', icon: History }, save: { title: '存档', icon: Bookmark }, settings: { title: '设置', icon: Settings }, attributes: { title: '属性', icon: BarChart3 }, }; export function VisualNovelRuntimePanel({ kind, draft, run, isBusy = false, isSaving = false, isLoadingArchives = false, resumingWorldKey = null, saveArchives = [], onClose, onRegenerateHistoryEntry, onSaveRun, onResumeSaveArchive, textModeEnabled = false, onTextModeChange, allowRegeneration = false, }: VisualNovelRuntimePanelProps) { if (typeof document === 'undefined') { return null; } const meta = PANEL_META[kind]; const Icon = meta.icon; return createPortal(
{ if (event.target === event.currentTarget) { onClose(); } }} >
event.stopPropagation()} >

{meta.title}

{kind === 'history' ? ( ) : null} {kind === 'save' ? ( ) : null} {kind === 'settings' ? ( ) : null} {kind === 'attributes' ? : null}
, document.body, ); } export default VisualNovelRuntimePanel;