import React from 'react'; import { MapContainer, TileLayer, Marker, Popup } from 'react-leaflet'; import 'leaflet/dist/leaflet.css'; import L from 'leaflet'; // Fix default marker icon broken by webpack/vite asset bundling delete L.Icon.Default.prototype._getIconUrl; L.Icon.Default.mergeOptions({ iconRetinaUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon-2x.png', iconUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png', shadowUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png', }); function PharmacyMap({ pharmacies }) { const located = pharmacies.filter(p => p.latitude != null && p.longitude != null); if (located.length === 0) return null; const center = [ located.reduce((s, p) => s + p.latitude, 0) / located.length, located.reduce((s, p) => s + p.longitude, 0) / located.length, ]; return (