diff --git a/client/src/containers/analysis-eudr/map/component.tsx b/client/src/containers/analysis-eudr/map/component.tsx index 2cf73f10e..86b1e39f0 100644 --- a/client/src/containers/analysis-eudr/map/component.tsx +++ b/client/src/containers/analysis-eudr/map/component.tsx @@ -5,6 +5,7 @@ import Map from 'react-map-gl/maplibre'; import { MapView } from '@deck.gl/core/typed'; import { TileLayer } from '@deck.gl/geo-layers/typed'; import { CartoLayer, setDefaultCredentials, MAP_TYPES, API_VERSIONS } from '@deck.gl/carto/typed'; +import { useParams } from 'next/navigation'; import ZoomControl from './zoom'; import LegendControl from './legend'; @@ -32,14 +33,27 @@ setDefaultCredentials({ }); const EUDRMap = () => { - const { basemap, planetCompare, supplierLayer, contextualLayers } = useAppSelector( - (state) => state.eudr, - ); + const { + basemap, + planetCompare, + supplierLayer, + contextualLayers, + filters: { suppliers, materials, origins, plots }, + } = useAppSelector((state) => state.eudr); const [hoverInfo, setHoverInfo] = useState(null); const [viewState, setViewState] = useState(DEFAULT_VIEW_STATE); - const plotGeometries = usePlotGeometries(); + const params = useParams(); + + const plotGeometries = usePlotGeometries({ + producerIds: params?.supplierId + ? [params.supplierId as string] + : suppliers?.map(({ value }) => value), + materialIds: materials?.map(({ value }) => value), + originIds: origins?.map(({ value }) => value), + geoRegionIds: plots?.map(({ value }) => value), + }); // Supplier plot layer const layer: GeoJsonLayer = new GeoJsonLayer({ diff --git a/client/src/hooks/eudr/index.ts b/client/src/hooks/eudr/index.ts index 0ec5df213..281bcaf0d 100644 --- a/client/src/hooks/eudr/index.ts +++ b/client/src/hooks/eudr/index.ts @@ -29,9 +29,9 @@ export const useEUDRSuppliers = ( export const usePlotGeometries = ( params?: { - producersIds: string[]; - originsId: string[]; - materialsId: string[]; + producerIds: string[]; + originIds: string[]; + materialIds: string[]; geoRegionIds: string[]; }, options: UseQueryOptions = {},