Skip to content

Commit

Permalink
map
Browse files Browse the repository at this point in the history
  • Loading branch information
anamontiaga committed Sep 1, 2023
1 parent 6b586be commit 38da8d2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/hooks/cost-surface/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export function useProjectCostSurfaces<T = CostSurface[]>(

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,
},
Expand Down
15 changes: 9 additions & 6 deletions app/layout/projects/show/map/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const ProjectMap = (): JSX.Element => {
isSidebarOpen,
layerSettings,
selectedFeatures: selectedFeaturesIds,
selectedCostSurfaces: selectedCostSurfacesIds,
} = useAppSelector((state) => state['/projects/[id]']);

const accessToken = useAccessToken();
Expand Down Expand Up @@ -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,
},
},
});
Expand Down Expand Up @@ -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'] : []),
Expand All @@ -170,6 +172,7 @@ export const ProjectMap = (): JSX.Element => {
],
options: {
layerSettings,
cost: { min: 1, max: 100 },
items: selectedPreviewFeatures,
},
});
Expand Down

0 comments on commit 38da8d2

Please sign in to comment.