import { useEffect, useState } from 'react'; import { createPortal } from 'react-dom'; import { Polyline, Marker, Popup, Circle, useMapEvents } from 'react-leaflet'; import L from 'leaflet'; import { mapItemService } from '../../services/mapItemService'; import { CABLE_COLORS, type MapItem, type CableType } from '../../types/mapItem'; import { ItemContextMenu } from './ItemContextMenu'; import { useDrawingStore } from '../../stores/drawingStore'; interface MapItemsLayerProps { mapId: string; refreshTrigger: number; readOnly?: boolean; } // Custom marker icons for devices using CSS const switchIcon = new L.DivIcon({ html: `
`, className: 'custom-device-marker', iconSize: [40, 40], iconAnchor: [20, 40], }); const indoorApIcon = new L.DivIcon({ html: ``, className: 'custom-device-marker', iconSize: [40, 40], iconAnchor: [20, 40], }); const outdoorApIcon = new L.DivIcon({ html: ``, className: 'custom-device-marker', iconSize: [40, 40], iconAnchor: [20, 40], }); export function MapItemsLayer({ mapId, refreshTrigger, readOnly = false }: MapItemsLayerProps) { const [items, setItems] = useState