/** * Cosmo - Deep Space Explorer * Main application component */ import { useState } from 'react'; import { useSpaceData } from './hooks/useSpaceData'; import { useTrajectory } from './hooks/useTrajectory'; import { Scene } from './components/Scene'; import { ProbeList } from './components/ProbeList'; import { Loading } from './components/Loading'; import type { CelestialBody } from './types'; function App() { const { bodies, loading, error } = useSpaceData(); const [selectedBody, setSelectedBody] = useState(null); const { trajectoryPositions } = useTrajectory(selectedBody); // Filter probes and planets from all bodies const probes = bodies.filter((b) => b.type === 'probe'); const planets = bodies.filter((b) => b.type === 'planet'); const handleBodySelect = (body: CelestialBody | null) => { setSelectedBody(body); }; if (loading) { return ; } if (error) { return (

数据加载失败

{error}

请确保后端 API 运行在 http://localhost:8000

); } return (
{/* Title overlay */}

Cosmo

深空探测器可视化

{selectedBody ? `聚焦: ${selectedBody.name}` : `${bodies.length} 个天体`}

{/* Probe List Sidebar */} {/* 3D Scene */} {/* Instructions overlay */}
{selectedBody ? ( <>

聚焦模式

点击侧边栏的"返回太阳系视图"按钮

) : ( <>

太阳系俯视图

🖱️ 左键拖动: 旋转

🖱️ 右键拖动: 平移

🖱️ 滚轮: 缩放

点击左侧天体列表查看详情

)}
); } export default App;