diff --git a/apps/fishing-map/features/map/Map.tsx b/apps/fishing-map/features/map/Map.tsx index 29a2cbea89..66fe370c2d 100644 --- a/apps/fishing-map/features/map/Map.tsx +++ b/apps/fishing-map/features/map/Map.tsx @@ -83,22 +83,6 @@ const MapWrapper = () => { useMapRulersDrag() const { rulers, editingRuler, rulersVisible } = useRulers() const { isMapDrawing } = useMapDrawConnect() - // const { generatorsConfig, globalConfig } = useGeneratorsConnect() - - // const setMapReady = useSetRecoilState(mapReadyAtom) - // const [hasTimeseries] = useAtom(hasMapTimeseriesAtom) - // const dataviews = useSelector(selectCurrentDataviewInstancesResolved) - // const isMapInteractionDisabled = useSelector(selectIsMapDrawing) - - // useLayerComposer is a convenience hook to easily generate a Mapbox GL style (see https://docs.mapbox.com/mapbox-gl-js/style-spec/) from - // the generatorsConfig (ie the map "layers") and the global configuration - // const { style, loading: layerComposerLoading } = useLayerComposer( - // generatorsConfig, - // globalConfig, - // defaultStyleTransformations, - // layerComposer - // ) - const layers = useMapDeckLayers() const setDeckLayers = useSetDeckLayerComposer() useEffect(() => { @@ -107,19 +91,6 @@ const MapWrapper = () => { } }, [setDeckLayers]) - // const { clickedEvent, dispatchClickedEvent, cancelPendingInteractionRequests } = - // useClickedEventConnect() - - // const onLoadCallback = useCallback(() => { - // setMapReady(true) - // }, [setMapReady]) - - // const closePopup = useCallback(() => { - // cleanFeatureState('click') - // dispatchClickedEvent(null) - // cancelPendingInteractionRequests() - // }, [cancelPendingInteractionRequests, cleanFeatureState, dispatchClickedEvent]) - const reportLocation = useSelector(selectIsAnyReportLocation) const isWorkspace = useSelector(selectIsWorkspaceLocation) @@ -131,91 +102,6 @@ const MapWrapper = () => { }, []) const mapLoading = useIsDeckLayersLoading() - // const [hoveredEvent, setHoveredEvent] = useState(null) - - // const [hoveredDebouncedEvent, setHoveredDebouncedEvent] = useState( - // null - // ) - // const onSimpleMapHover = useSimpleMapHover(setHoveredEvent as InteractionEventCallback) - // const onMapHover = useMapHover( - // setHoveredEvent as InteractionEventCallback, - // setHoveredDebouncedEvent as InteractionEventCallback, - // map, - // style?.metadata - // ) - // const currentMapHoverCallback = useMemo(() => { - // return rulersEditing ? onMapHoverWithRuler : onMapHover - // }, [rulersEditing, onMapHoverWithRuler, onMapHover]) - - // const hoveredTooltipEvent = parseMapTooltipEvent(hoveredEvent, dataviews, temporalgridDataviews) - // useMapHighlightedEvent(hoveredTooltipEvent?.features) - - // const showTimeComparison = useSelector(selectShowTimeComparison) - // const debugOptions = useSelector(selectDebugOptions) - - // const mapLegends = useMapLegend(style, dataviews, hoveredEvent) - // const portalledLegend = !showTimeComparison - - // const mapLoaded = useMapLayersLoaded() - // const tilesClusterLoaded = useMapClusterTilesLoaded() - - // const getCursor = useCallback(() => { - // if (isMapDrawing || isMarineManagerLocation) { - // // updating cursor using css at style.css as the library sets classes depending on the state - // return undefined - // } else if (hoveredTooltipEvent) { - // // Workaround to fix cluster events duplicated, only working for encounters and needs - // // TODO if wanted to scale it to other layers - // const clusterConfig = dataviews.find((d) => d.config?.type === GeneratorType.TileCluster) - // const eventsCount = clusterConfig?.config?.duplicatedEventsWorkaround ? 2 : 1 - - // const clusterFeature = hoveredTooltipEvent.features.find( - // (f) => f.type === GeneratorType.TileCluster && parseInt(f.properties.count) > eventsCount - // ) - - // if (clusterFeature) { - // if (!tilesClusterLoaded) { - // return 'progress' - // } - // const { expansionZoom, lat, lng, lon } = clusterFeature.properties - // const longitude = lng || lon - // return expansionZoom && lat && longitude ? 'zoom-in' : 'grab' - // } - // const vesselFeatureEvents = hoveredTooltipEvent.features.filter( - // (f) => f.category === DataviewCategory.Vessels - // ) - // if (vesselFeatureEvents.length > 1) { - // return 'grab' - // } - // return 'pointer' - // } else if (map?.isMoving()) { - // return 'grabbing' - // } - // return 'grab' - // }, [ - // isMapDrawing, - // isMarineManagerLocation, - // hoveredTooltipEvent, - // map, - // dataviews, - // tilesClusterLoaded, - // ]) - - // useEffect(() => { - // if (map) { - // map.showTileBoundaries = debugOptions.debug - // } - // // eslint-disable-next-line react-hooks/exhaustive-deps - // }, [map, debugOptions]) - - // const styleInteractiveLayerIds = useMemoCompare(style?.metadata?.interactiveLayerIds) - // const interactiveLayerIds = useMemo(() => { - // if (isMapInteractionDisabled) { - // return undefined - // } - // return styleInteractiveLayerIds - // }, [isMapInteractionDisabled, styleInteractiveLayerIds]) - const setDeckLayerLoadedState = useSetDeckLayerLoadedState() const { onDrawEdit, onDrawClick, drawLayerMode, drawFeaturesIndexes, drawFeatures } = useDrawLayer() @@ -273,54 +159,6 @@ const MapWrapper = () => { {isMapDrawing && } - {/* {style && ( - - {clickedEvent && ( - - )} - {hoveredTooltipEvent && - !clickedEvent && - hoveredEvent?.latitude === hoveredDebouncedEvent?.latitude && - hoveredEvent?.longitude === hoveredDebouncedEvent?.longitude && ( - - )} - - - - {isMapDrawing && } - {mapLegends && } - - )} */} {/* TODO in deck.gl to get the mapLoading state */} {isWorkspace && !reportLocation && (