import { useRef, useState, Suspense } from 'react'
import Scene from './components/Scene'
import Toolbar from './components/Toolbar'
import Timeline from './components/Timeline'
import ModelsPanel from './components/ModelsPanel'
import PropertiesPanel from './components/PropertiesPanel'
import ExportPanel from './components/ExportPanel'
import AnimationPlayer from './components/AnimationPlayer'
import CameraMode from './components/CameraMode'
import SkyboxPanel from './components/SkyboxPanel'
import PhysicsPanel from './components/PhysicsPanel'
import AIController from './components/AIController'
import LightsPanel from './components/LightsPanel'
import ProjectPanel from './components/ProjectPanel'
import useStore from './store/useStore'
const TABS = [
{ id:'models', icon:'📦', label:'Models' },
{ id:'properties', icon:'⚙', label:'Properties' },
{ id:'animations', icon:'🎞', label:'Animations' },
{ id:'camera', icon:'🎥', label:'Camera' },
{ id:'skybox', icon:'🌐', label:'Skybox' },
{ id:'physics', icon:'⚡', label:'Physics' },
{ id:'lights', icon:'💡', label:'Lights' },
{ id:'ai', icon:'✦', label:'AI' },
{ id:'project', icon:'🗂', label:'Project' },
{ id:'export', icon:'▶', label:'Export' },
]
function PanelContent({ id, canvasRef }) {
return (
{id==='models' &&
}
{id==='properties' &&
}
{id==='animations' &&
}
{id==='camera' &&
}
{id==='skybox' &&
}
{id==='physics' &&
}
{id==='ai' &&
}
{id==='lights' &&
}
{id==='project' &&
}
{id==='export' &&
}
)
}
function Loading() {
return (
)
}
// ── Desktop: icon rail + slide panel ─────────────────────────────────────────
function DesktopLayout({ canvasRef }) {
const { activePanel, setActivePanel } = useStore()
const PANEL_W = 280
return (
{/* Canvas */}
}>
{/* Slide panel */}
{activePanel && (
{TABS.find(t=>t.id===activePanel)?.icon}
{TABS.find(t=>t.id===activePanel)?.label}
)}
{/* Icon rail */}
{TABS.map(t => {
const isAI = t.id === 'ai'
return (
)
})}
)
}
// ── Mobile ────────────────────────────────────────────────────────────────────
function MobileLayout({ canvasRef }) {
const { activePanel, setActivePanel } = useStore()
return (
}>
{activePanel && (
{TABS.find(t=>t.id===activePanel)?.icon}
{TABS.find(t=>t.id===activePanel)?.label}
)}
{TABS.map(t => (
))}
)
}
// ── Root ───────────────────────────────────────────────────────────────────────
export default function App() {
const canvasRef = useRef()
const showTimeline = useStore(s => s.showTimeline)
const [mobile] = useState(() => window.innerWidth < 640)
return (
)
}