import { useState } from 'react'; import { ChevronLeft, ChevronRight, Search, Globe, Rocket } from 'lucide-react'; import type { CelestialBody } from '../types'; interface ProbeListProps { probes: CelestialBody[]; planets: CelestialBody[]; onBodySelect: (body: CelestialBody | null) => void; selectedBody: CelestialBody | null; onResetCamera: () => void; } export function ProbeList({ probes, planets, onBodySelect, selectedBody, onResetCamera }: ProbeListProps) { const [isCollapsed, setIsCollapsed] = useState(false); const [searchTerm, setSearchTerm] = useState(''); // Calculate distance for sorting const calculateDistance = (body: CelestialBody) => { const pos = body.positions[0]; return Math.sqrt(pos.x ** 2 + pos.y ** 2 + pos.z ** 2); }; const processBodies = (list: CelestialBody[]) => { return list .filter(b => (b.name_zh || b.name).toLowerCase().includes(searchTerm.toLowerCase()) && b.type !== 'star' // Exclude Sun from list ) .map(body => ({ body, distance: calculateDistance(body) })) .sort((a, b) => a.distance - b.distance); }; const planetList = processBodies(planets); const probeList = processBodies(probes); return (