'use client'; import { useState } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import type { WatchlistEntry } from '@/hooks/useWatchlist'; import { Eye, X, Trash2, ChevronUp, ChevronDown, Crosshair } from 'lucide-react'; function getTypeIcon(type: string) { switch (type) { case 'flight': return 'โœˆ'; case 'ship': return '๐Ÿšข'; case 'news': return '๐Ÿ“ฐ'; case 'satellite': return '๐Ÿ›ฐ'; default: return '๐Ÿ“'; } } function getTypeColor(type: string) { switch (type) { case 'flight': return '#22d3ee'; case 'ship': return '#3b82f6'; case 'news': return '#f97316'; case 'satellite': return '#a855f7'; default: return '#6b7280'; } } export default function WatchlistWidget({ items, onRemove, onClear, onFlyTo, }: { items: WatchlistEntry[]; onRemove: (id: string) => void; onClear: () => void; onFlyTo?: (lat: number, lng: number) => void; }) { const [expanded, setExpanded] = useState(false); if (items.length === 0) return null; return (
{expanded && ( {/* Header */}
WATCHLIST
{/* Items */}
{items.map((item) => (
onFlyTo?.(item.lat, item.lng)} > {/* Type icon */} {getTypeIcon(item.type)} {/* Info */}
{item.name}
{item.type} {item.altitude != null && ` ยท ${Math.round(item.altitude).toLocaleString()} ft`} {item.speed != null && ` ยท ${Math.round(item.speed)} kts`} {item.risk_score != null && ` ยท LVL ${item.risk_score}`}
{/* Fly-to button */} {/* Remove button */}
))}
)}
{/* Collapsed badge */}
); }