You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.0 KiB
2.0 KiB
Reusable MapCN Component Prompt
Create or update a geospatial visualization using the project-owned MapCN
component in src/shared/components/ui/map.tsx.
React composition contract
- Root:
Map, configured with typed MapLibre options. - Choose only the required children:
MapMarker,MarkerContent,MarkerPopup,MarkerTooltip,MarkerLabel,MapControls,MapRoute,MapArc,MapGeoJSON, orMapClusterLayer. - Data enters through typed props; fetching, auth, and routing remain in the feature container.
- Use controlled
viewportandonViewportChangeonly when another part of the UI must own map position.
Styling theme: operational geography
- Match semantic project surfaces, borders, typography, and light/dark mode.
- Keep markers legible over both basemap themes.
- Use status color together with text, shape, or icons.
- Popups should be concise, scannable, and keyboard reachable.
- Controls should not obscure critical features on small screens.
- Prefer the built-in CARTO style unless the feature requires another MapLibre-compatible source.
Request
- Purpose:
<What geographic decision or relationship the map explains> - Initial viewport:
<Center, zoom, pitch, and bearing> - Data/layers:
<Markers, route, arc, GeoJSON, or clusters> - Interactions:
<Hover, click, select, drag, locate, or fullscreen> - Loading/empty/error states:
<Expected behavior> - Mobile behavior:
<Control placement and supporting content>
Acceptance criteria
- The visualization composes the existing MapCN source instead of adding another map wrapper.
- Coordinates and GeoJSON are explicitly typed and validated at the boundary.
- Loading, unavailable tiles/data, empty results, and selected features are understandable.
- Keyboard focus, popup labels, contrast, and reduced motion are addressed.
- Light/dark theme changes do not require remounting feature state.
Run focused verification allowed by agents.md and finish with a simple
TL;DR.