Skip to content

Commit

Permalink
add is custom property
Browse files Browse the repository at this point in the history
  • Loading branch information
anamontiaga committed Sep 1, 2023
1 parent 60e5aea commit 21ba983
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
3 changes: 3 additions & 0 deletions app/hooks/cost-surface/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ export function useProjectCostSurfaces<T = CostSurface[]>(
{
id: 'gfehrtf22534geyg',
name: 'Cost Surface Rwanda A',
isCustom: true,
scenarioUsageCount: 3,
},
{
id: 'rfjghhrtersdtbkjshfw',
name: 'Cost Surface Rwanda B',
isCustom: true,
scenarioUsageCount: 0,
},
{
id: '23275455HGVVCMSJHDFk',
name: 'Cost Surface Rwanda C',
isCustom: true,
scenarioUsageCount: 0,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type DataItem = {
scenarios: number;
tag?: string;
isVisibleOnMap: boolean;
isCustom: boolean;
isCustom?: boolean;
};

export type InventoryTable = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const InventoryPanelCostSurface = ({ noData: noDataMessage }: { noData: string }
data?.map((cs) => ({
id: cs.id,
name: cs.name,
isCustom: cs.isCustom,
scenarioUsageCount: cs.scenarioUsageCount,
})),
keepPreviousData: true,
Expand Down Expand Up @@ -106,11 +107,12 @@ const InventoryPanelCostSurface = ({ noData: noDataMessage }: { noData: string }

const displayBulkActions = selectedCostSurfaceIds.length > 0;

const data: DataItem[] = allProjectCostSurfacesQuery.data?.map((wdpa) => ({
...wdpa,
name: wdpa.name,
scenarios: wdpa.scenarioUsageCount,
isVisibleOnMap: visibleCostSurfaces?.includes(wdpa.id),
const data: DataItem[] = allProjectCostSurfacesQuery.data?.map((cs) => ({
...cs,
name: cs.name,
scenarios: cs.scenarioUsageCount,
isCustom: cs.isCustom,
isVisibleOnMap: visibleCostSurfaces?.includes(cs.id),
}));

return (
Expand Down
1 change: 1 addition & 0 deletions app/types/api/cost-surface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export interface CostSurface {
id: string;
name: string;
isCustom: boolean;
scenarioUsageCount: number;
}

0 comments on commit 21ba983

Please sign in to comment.