22 entityPrimaryKeyProperty ,
33 type VariableValue ,
44} from '@codaco/shared-consts' ;
5- import { type ExtendedMapOptions } from '~/lib/interviewer/Interfaces/Geospatial/useMapbox' ;
65import { type Action } from '@reduxjs/toolkit' ;
76import { LocateFixed , ZoomIn , ZoomOut } from 'lucide-react' ;
7+ import { type ExtendedMapOptions } from '~/lib/interviewer/Interfaces/Geospatial/useMapbox' ;
88// import 'mapbox-gl/dist/mapbox-gl.css';
99import { AnimatePresence , motion , type Variants } from 'motion/react' ;
1010import dynamic from 'next/dynamic' ;
@@ -20,8 +20,8 @@ import { updateNode as updateNodeAction } from '~/lib/interviewer/ducks/modules/
2020import useBeforeNext from '~/lib/interviewer/hooks/useBeforeNext' ;
2121import usePropSelector from '~/lib/interviewer/hooks/usePropSelector' ;
2222import useReadyForNextStage from '~/lib/interviewer/hooks/useReadyForNextStage' ;
23- import CollapsablePrompts from '~/lib/interviewer/Interfaces/Sociogram/CollapsablePrompts' ;
2423import { useMapbox } from '~/lib/interviewer/Interfaces/Geospatial/useMapbox' ;
24+ import CollapsablePrompts from '~/lib/interviewer/Interfaces/Sociogram/CollapsablePrompts' ;
2525import { getNetworkNodesForType } from '~/lib/interviewer/selectors/session' ;
2626import { type RootState } from '~/lib/interviewer/store' ;
2727import { type Direction , type StageProps } from '~/lib/interviewer/types' ;
@@ -130,6 +130,8 @@ export default function GeospatialInterface({
130130 mapContainerRef,
131131 mapRef,
132132 accessToken,
133+ isMapLoaded,
134+ zoomLevel,
133135 handleResetMapZoom,
134136 handleZoomIn,
135137 handleZoomOut,
@@ -230,14 +232,19 @@ export default function GeospatialInterface({
230232 return (
231233 < div className = "relative flex size-full flex-col" ref = { dragSafeRef } >
232234 < motion . div
233- id = "map-container"
234235 className = "size-full"
235236 ref = { mapContainerRef }
236237 variants = { fadeVariants }
238+ data-testid = "map-container"
239+ data-map-loaded = { isMapLoaded }
240+ data-zoom-level = { zoomLevel }
237241 >
238242 { /* if outside-selectable-areas, add an overlay */ }
239243 { initialSelectionValue === 'outside-selectable-areas' && (
240- < div className = "absolute inset-0 z-10 flex flex-col items-center justify-center" >
244+ < div
245+ className = "absolute inset-0 z-10 flex flex-col items-center justify-center"
246+ data-testid = "outside-selectable-overlay"
247+ >
241248 < div className = "bg-background absolute inset-0 opacity-75" />
242249 < div className = "relative z-20 flex w-1/3 flex-col items-center gap-6 text-center" >
243250 < h2 >
@@ -250,6 +257,7 @@ export default function GeospatialInterface({
250257 setLocationValue ( null ) ;
251258 } }
252259 color = "primary"
260+ data-testid = "deselect-outside-area-button"
253261 >
254262 Deselect
255263 </ Button >
@@ -274,6 +282,7 @@ export default function GeospatialInterface({
274282 spacing = "none"
275283 elevation = "none"
276284 className = "bg-surface/60 absolute right-4 bottom-4 z-5 flex flex-col gap-2 rounded-xl p-2 shadow-2xl backdrop-blur-md"
285+ data-testid = "map-toolbar"
277286 variants = { {
278287 initial : {
279288 opacity : 0 ,
@@ -291,20 +300,23 @@ export default function GeospatialInterface({
291300 icon = { < ZoomIn /> }
292301 aria-label = "Zoom In"
293302 color = "dynamic"
303+ data-testid = "map-zoom-in"
294304 />
295305 < IconButton
296306 size = "lg"
297307 onClick = { handleZoomOut }
298308 icon = { < ZoomOut /> }
299309 aria-label = "Zoom Out"
300310 color = "dynamic"
311+ data-testid = "map-zoom-out"
301312 />
302313 < IconButton
303314 size = "lg"
304315 onClick = { handleResetMapZoom }
305316 icon = { < LocateFixed /> }
306317 aria-label = "Recenter Map"
307318 color = "dynamic"
319+ data-testid = "map-recenter"
308320 />
309321 </ MotionSurface >
310322
@@ -333,6 +345,7 @@ export default function GeospatialInterface({
333345 color = "primary"
334346 onClick = { handleOutsideSelectableAreas }
335347 disabled = { initialSelectionValue === 'outside-selectable-areas' }
348+ data-testid = "outside-selectable-areas-button"
336349 >
337350 Outside Selectable Areas
338351 </ Button >
0 commit comments