"use client"; import { MapContainer, Marker, Popup, TileLayer } from "react-leaflet"; import L from "leaflet"; import "leaflet/dist/leaflet.css"; import type { CitySummary } from "@/lib/types"; type MapCanvasProps = { cities: CitySummary[]; selectedCity: string | null; onSelectCity: (cityName: string) => void; }; function shortName(name: string) { return name.length > 8 ? `${name.slice(0, 7)}.` : name; } const tempIcon = ( city: CitySummary, selected: boolean, ) => L.divIcon({ className: "", html: `
${shortName(city.display_name)}
`, iconSize: [78, 30], iconAnchor: [39, 15], }); export function MapCanvas({ cities, selectedCity, onSelectCity }: MapCanvasProps) { return ( {cities.map((city) => ( onSelectCity(city.name) }} >

{city.display_name}

Risk: {city.risk_level}

{selectedCity === city.name ? "Selected" : "Click to open"}

))}
); }