From 38da8d22f252cd0c3e5d888ad9330faa6fef58a3 Mon Sep 17 00:00:00 2001 From: anamontiaga Date: Fri, 1 Sep 2023 16:05:58 +0200 Subject: [PATCH] map --- app/hooks/cost-surface/index.ts | 4 ++-- app/layout/projects/show/map/index.tsx | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/hooks/cost-surface/index.ts b/app/hooks/cost-surface/index.ts index b923449722..bfca3f3cd1 100644 --- a/app/hooks/cost-surface/index.ts +++ b/app/hooks/cost-surface/index.ts @@ -17,8 +17,8 @@ export function useProjectCostSurfaces( const mockData: CostSurface[] = [ { - id: 'gfehrtf22534geyg', - name: 'Cost Surface Rwanda A', + id: 'b7454579-c48e-4e2f-8438-833280cb65d8', + name: 'Brazil 15 k Cost Surface', isCustom: true, scenarioUsageCount: 3, }, diff --git a/app/layout/projects/show/map/index.tsx b/app/layout/projects/show/map/index.tsx index c8c5a3ded3..e6ad85f4c8 100644 --- a/app/layout/projects/show/map/index.tsx +++ b/app/layout/projects/show/map/index.tsx @@ -47,6 +47,7 @@ export const ProjectMap = (): JSX.Element => { isSidebarOpen, layerSettings, selectedFeatures: selectedFeaturesIds, + selectedCostSurfaces: selectedCostSurfacesIds, } = useAppSelector((state) => state['/projects/[id]']); const accessToken = useAccessToken(); @@ -108,19 +109,19 @@ export const ProjectMap = (): JSX.Element => { const PUGridLayer = usePUGridLayer({ active: rawScenariosIsFetched && rawScenariosData && !!rawScenariosData.length && !sid2, sid: sid ? `${sid}` : null, - include: 'results', - sublayers: [...(sid1 && !sid2 ? ['frequency'] : [])], + include: 'results,cost', + sublayers: [ + ...(sid1 && !sid2 ? ['frequency'] : []), + ...(!!selectedCostSurfacesIds.length ? ['cost'] : []), + ], options: { + cost: { min: 1, max: 100 }, settings: { pugrid: layerSettings.pugrid, 'wdpa-percentage': layerSettings['wdpa-percentage'], features: layerSettings.features, cost: layerSettings.cost, - 'lock-in': layerSettings['lock-in'], - 'lock-out': layerSettings['lock-out'], - 'lock-available': layerSettings['lock-available'], frequency: layerSettings.frequency, - solution: layerSettings.solution, }, }, }); @@ -161,6 +162,7 @@ export const ProjectMap = (): JSX.Element => { const LEGEND = useLegend({ layers: [ ...(!!selectedFeaturesData?.length ? ['features-preview'] : []), + ...(!!selectedCostSurfacesIds?.length ? ['cost'] : []), ...(!!sid1 && !sid2 ? ['frequency'] : []), ...(!!sid1 && !!sid2 ? ['compare'] : []), @@ -170,6 +172,7 @@ export const ProjectMap = (): JSX.Element => { ], options: { layerSettings, + cost: { min: 1, max: 100 }, items: selectedPreviewFeatures, }, });