import React, { useState } from 'react'; import { BookProject, UserProfile, ViewMode, ChatMessage } from '../../types'; import AIPanel from '../AIPanel'; import { Book, FileText, Globe, GitGraph, Lightbulb, Settings, Menu, ChevronRight, ChevronLeft, Share2, HelpCircle, LogOut, LayoutDashboard, User, Plus, Trash2 } from 'lucide-react'; interface EditorShellProps { project: BookProject; user: UserProfile; viewMode: ViewMode; currentChapterId: string; chatHistory: ChatMessage[]; isGenerating: boolean; onViewModeChange: (mode: ViewMode) => void; onChapterSelect: (id: string) => void; onUpdateProject: (updates: Partial) => void; onAddChapter: () => Promise; onDeleteChapter: (id: string) => void; onLogout: () => void; onSendMessage: (msg: string) => void; onInsertText: (text: string) => void; onOpenExport: () => void; onOpenHelp: () => void; children: React.ReactNode; } const EditorShell: React.FC = (props) => { const { project, user, viewMode, currentChapterId, children } = props; const [isSidebarOpen, setIsSidebarOpen] = useState(true); const [isAiPanelOpen, setIsAiPanelOpen] = useState(true); const currentChapter = project.chapters.find(c => c.id === currentChapterId); return (
{/* SIDEBAR */} {/* MAIN CONTENT */}
{viewMode === 'write' ? ( props.onUpdateProject({ chapters: project.chapters.map(c => c.id === currentChapterId ? { ...c, title: e.target.value } : c) })} className="font-serif font-bold text-lg bg-transparent border-b border-transparent focus:border-blue-500 focus:outline-none" /> ) : ( {viewMode} )}
{children}
{/* AI PANEL */}
{isAiPanelOpen && }
); }; export default EditorShell;