diff --git a/frontend/src/features/Dashboard/components/Layers/index.tsx b/frontend/src/features/Dashboard/components/Layers/ActiveDashboardLayer.tsx similarity index 99% rename from frontend/src/features/Dashboard/components/Layers/index.tsx rename to frontend/src/features/Dashboard/components/Layers/ActiveDashboardLayer.tsx index a8f6826f2..362109059 100644 --- a/frontend/src/features/Dashboard/components/Layers/index.tsx +++ b/frontend/src/features/Dashboard/components/Layers/ActiveDashboardLayer.tsx @@ -27,7 +27,7 @@ import type { BaseMapChildrenProps } from '@features/map/BaseMap' import type { VectorLayerWithName } from 'domain/types/layer' import type { Geometry } from 'ol/geom' -export function DashboardLayer({ map }: BaseMapChildrenProps) { +export function ActiveDashboardLayer({ map }: BaseMapChildrenProps) { const displayDashboardLayer = useAppSelector(state => state.global.displayDashboardLayer) const activeDashboardId = useAppSelector(state => state.dashboard.activeDashboardId) diff --git a/frontend/src/features/map/layers/Dashboards/index.tsx b/frontend/src/features/Dashboard/components/Layers/DashboardsLayer.tsx similarity index 92% rename from frontend/src/features/map/layers/Dashboards/index.tsx rename to frontend/src/features/Dashboard/components/Layers/DashboardsLayer.tsx index 32d63c743..c547cbdaf 100644 --- a/frontend/src/features/map/layers/Dashboards/index.tsx +++ b/frontend/src/features/Dashboard/components/Layers/DashboardsLayer.tsx @@ -1,6 +1,9 @@ import { useGetDashboardsQuery } from '@api/dashboardsAPI' import { selectDashboardOnMap } from '@features/Dashboard/useCases/selectDashboardOnMap' +import { useAppDispatch } from '@hooks/useAppDispatch' +import { useAppSelector } from '@hooks/useAppSelector' import { OPENLAYERS_PROJECTION, THEME, WSG84_PROJECTION } from '@mtes-mct/monitor-ui' +import { Layers } from 'domain/entities/layers/constants' import { convertToFeature } from 'domain/types/map' import { Feature } from 'ol' import { getCenter } from 'ol/extent' @@ -11,11 +14,7 @@ import VectorSource from 'ol/source/Vector' import { Icon, Style } from 'ol/style' import { useEffect, useRef, type MutableRefObject } from 'react' -import { Layers } from '../../../../domain/entities/layers/constants' -import { useAppDispatch } from '../../../../hooks/useAppDispatch' -import { useAppSelector } from '../../../../hooks/useAppSelector' - -import type { BaseMapChildrenProps } from '../../BaseMap' +import type { BaseMapChildrenProps } from '@features/map/BaseMap' import type { VectorLayerWithName } from 'domain/types/layer' export function DashboardsLayer({ map, mapClickEvent }: BaseMapChildrenProps) { diff --git a/frontend/src/features/map/layers/Dashboards/SelectedDashboardLayer.tsx b/frontend/src/features/Dashboard/components/Layers/SelectedDashboardLayer.tsx similarity index 82% rename from frontend/src/features/map/layers/Dashboards/SelectedDashboardLayer.tsx rename to frontend/src/features/Dashboard/components/Layers/SelectedDashboardLayer.tsx index d89eb3014..8e1f7052e 100644 --- a/frontend/src/features/map/layers/Dashboards/SelectedDashboardLayer.tsx +++ b/frontend/src/features/Dashboard/components/Layers/SelectedDashboardLayer.tsx @@ -1,29 +1,28 @@ import { Dashboard } from '@features/Dashboard/types' +import { getAMPFeature } from '@features/map/layers/AMP/AMPGeometryHelpers' +import { getAMPLayerStyle } from '@features/map/layers/AMP/AMPLayers.style' +import { getRegulatoryFeature } from '@features/map/layers/Regulatory/regulatoryGeometryHelpers' +import { getRegulatoryLayerStyle } from '@features/map/layers/styles/administrativeAndRegulatoryLayers.style' +import { measurementStyle, measurementStyleWithCenter } from '@features/map/layers/styles/measurement.style' import { overlayStroke } from '@features/map/overlays/style' import { getReportingZoneFeature } from '@features/Reportings/components/ReportingLayer/Reporting/reportingsGeometryHelpers' import { editingReportingStyleFn } from '@features/Reportings/components/ReportingLayer/Reporting/style' import { getVigilanceAreaLayerStyle } from '@features/VigilanceArea/components/VigilanceAreaLayer/style' import { getVigilanceAreaZoneFeature } from '@features/VigilanceArea/components/VigilanceAreaLayer/vigilanceAreaGeometryHelper' -import { OPENLAYERS_PROJECTION, WSG84_PROJECTION } from '@mtes-mct/monitor-ui' +import { useAppDispatch } from '@hooks/useAppDispatch' +import { useAppSelector } from '@hooks/useAppSelector' +import { WSG84_PROJECTION, OPENLAYERS_PROJECTION } from '@mtes-mct/monitor-ui' +import { Layers } from 'domain/entities/layers/constants' import { getOverlayCoordinates } from 'domain/shared_slices/Global' import { Feature } from 'ol' -import { GeoJSON as OLGeoJSON } from 'ol/format' -import { type Geometry } from 'ol/geom' +import { GeoJSON } from 'ol/format' import VectorLayer from 'ol/layer/Vector' import VectorSource from 'ol/source/Vector' -import { useEffect, useRef, type MutableRefObject } from 'react' - -import { Layers } from '../../../../domain/entities/layers/constants' -import { useAppDispatch } from '../../../../hooks/useAppDispatch' -import { useAppSelector } from '../../../../hooks/useAppSelector' -import { getAMPFeature } from '../AMP/AMPGeometryHelpers' -import { getAMPLayerStyle } from '../AMP/AMPLayers.style' -import { getRegulatoryFeature } from '../Regulatory/regulatoryGeometryHelpers' -import { getRegulatoryLayerStyle } from '../styles/administrativeAndRegulatoryLayers.style' -import { measurementStyle, measurementStyleWithCenter } from '../styles/measurement.style' - -import type { BaseMapChildrenProps } from '../../BaseMap' +import { useRef, type MutableRefObject, useEffect } from 'react' + +import type { BaseMapChildrenProps } from '@features/map/BaseMap' import type { VectorLayerWithName } from 'domain/types/layer' +import type { Geometry } from 'ol/geom' export function SelectedDashboardLayer({ map }: BaseMapChildrenProps) { const dispatch = useAppDispatch() @@ -72,7 +71,7 @@ export function SelectedDashboardLayer({ map }: BaseMapChildrenProps) { useEffect(() => { dashboardDatasVectorSourceRef.current.clear(true) if (selectedDashboardOnMap) { - const geoJSON = new OLGeoJSON() + const geoJSON = new GeoJSON() const geometry = geoJSON.readGeometry(selectedDashboardOnMap.geom, { dataProjection: WSG84_PROJECTION, diff --git a/frontend/src/features/map/index.tsx b/frontend/src/features/map/index.tsx index 92f7bb0ec..35b854117 100644 --- a/frontend/src/features/map/index.tsx +++ b/frontend/src/features/map/index.tsx @@ -1,7 +1,9 @@ -import { DashboardLayer } from '@features/Dashboard/components/Layers' +import { ActiveDashboardLayer } from '@features/Dashboard/components/Layers/ActiveDashboardLayer' +import { DashboardsLayer } from '@features/Dashboard/components/Layers/DashboardsLayer' import { DrawDashboardLayer } from '@features/Dashboard/components/Layers/DrawDashboardLayer' import { DashboardPreviewLayer } from '@features/Dashboard/components/Layers/PreviewDashboardLayer' import { DashboardReportingOverlay } from '@features/Dashboard/components/Layers/ReportingOverlay' +import { SelectedDashboardLayer } from '@features/Dashboard/components/Layers/SelectedDashboardLayer' import { LayersOverlay } from '@features/layersSelector/overlays' import { LayerEvents } from '@features/layersSelector/overlays/LayerEvents' import { VigilanceAreasLayer } from '@features/VigilanceArea/components/VigilanceAreaLayer' @@ -16,8 +18,6 @@ import { MapCoordinatesBox } from './controls/MapCoordinatesBox' import { AdministrativeLayers } from './layers/AdministrativeLayers' import { AMPLayers } from './layers/AMP' import { AMPPreviewLayer } from './layers/AMP/AMPPreviewLayer' -import { DashboardsLayer } from './layers/Dashboards' -import { SelectedDashboardLayer } from './layers/Dashboards/SelectedDashboardLayer' import { DrawLayer } from './layers/DrawLayer' import { MapLayer } from './layers/MapLayer' import { MeasurementLayer } from './layers/MeasurementLayer' @@ -218,7 +218,7 @@ export function Map({ isSuperUser }) { {/* @ts-ignore */} {/* @ts-ignore */} - + {/* @ts-ignore */} {/* @ts-ignore */}