'use client'; import { MapContainer, TileLayer, Marker, Popup } from 'react-leaflet'; import L from 'leaflet'; import 'leaflet/dist/leaflet.css'; // Fix for default markers in react-leaflet delete (L.Icon.Default.prototype as any)._getIconUrl; L.Icon.Default.mergeOptions({ iconRetinaUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-icon-2x.png', iconUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-icon.png', shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-shadow.png', }); interface LocationData { name: string; lat: number; lng: number; available: boolean; passType: string; } interface MapComponentProps { locations: LocationData[]; } const createCustomIcon = (available: boolean) => { const color = available ? '#4CAF50' : '#f44336'; return L.divIcon({ className: 'custom-marker', html: `
`, iconSize: [20, 20], iconAnchor: [10, 10], }); }; export default function MapComponent({ locations }: MapComponentProps) { // Center map on San Diego const center: [number, number] = [32.7157, -117.1611]; return ( {locations.map((location, index) => (

{location.name} Library

Status: {location.available ? 'Available' : 'Not Available'}

Pass Type: {location.passType}

))}
); }