import { MapContainer, TileLayer, CircleMarker, Popup, Polyline } from 'react-leaflet'; import 'leaflet/dist/leaflet.css'; interface Neighbor { lat: number | null; lon: number | null; name: string | null; pubkey_prefix: string; snr: number; } interface Props { neighbors: Neighbor[]; radioLat?: number | null; radioLon?: number | null; radioName?: string | null; } export function NeighborsMiniMap({ neighbors, radioLat, radioLon, radioName }: Props) { const valid = neighbors.filter( (n): n is Neighbor & { lat: number; lon: number } => n.lat != null && n.lon != null ); const hasRadio = radioLat != null && radioLon != null && !(radioLat === 0 && radioLon === 0); if (valid.length === 0 && !hasRadio) return null; // Center on radio if available, otherwise first neighbor const center: [number, number] = hasRadio ? [radioLat!, radioLon!] : [valid[0].lat, valid[0].lon]; return (