Conversation
…Map uses anchor callback
|
Thanks for the refactor here — the direction is solid (pure 1)
|
|
@ZackLyon that was codex talking. It posted before I could personally edit but I asked it to prioritize these 3 potential bugs for you. Take a look and see if they're worth attention now as opposed to later. |
Library build and types
baseUrlandpathsso the package builds only its ownsrc/, producingdist/index.d.tsand avoiding monorepo path resolution into other packages.useDepthRequestfrom@mbari/utilsso MapDepthDisplay can import from the package root instead of a subpath.typeprop; MapDepthDisplay imports from@mbari/utilsand types the depth promise result; MissionStep importsSortDirectionvia a relative path instead ofreact-ui/src/....Single Google + Leaflet loader (app only)
apps/lrauv-dash2/lib/leafletPlugins.ts: One place that loads the Google Maps script (withplacesandelevation), ensures Leaflet is loaded andwindow.Lis set, then dynamically imports the googlemutant plugin. Idempotent via a shared promise.initLeafletGoogle(apiKey)when a key is available.@googlemaps/js-api-loaderorLoader().importLibrary(). It only reports whetherwindow.google?.mapsis available (e.g. via polling).Map stays a pure library
loadGoogleMapsOnce, no dynamic import of googlemutant, nomapreadylistener that added a Google layer). Map only conditionally renders the Google base layer whenwindow.google?.mapsexists and usesuseGoogMapsLoader={false}.@mbari/react-ui/src/css/base.cssimport; kept Leaflet and package dist CSS imports.onRequestVehicleColors(anchor)with an optional{ top, left }anchor. The app owns the modal and passes the callback.App: vehicle colors modal and callbacks
onRequestVehicleColorsis now(anchor?: { top: number; left: number }) => void.insertBeforeerrors.handleVehicleColorRequestaccepts an optional anchor and sets modal position.invalidateSize).Modalfrom@mbari/react-uiinstead of@mbari/react-ui/src/Modal/Modal.Next and app types
transpilePackagesfor@mbari/react-ui,@mbari/utils,@mbari/api-client.apps/lrauv-dash2/types/global.d.tswith a singleWindow.google?: anydeclaration. Removed duplicateWindow.googledeclarations fromuseGoogleMaps.ts,leafletPlugins.ts, andelevationService.ts.apps/lrauv-dash2/types/leaflet-googlemutant-shim.d.tsso the dynamic import ofleaflet.gridlayer.googlemutant/dist/Leaflet.GoogleMutant.jsis a valid module for TypeScript.