period || 'annual', [period]);
const getBars = useCallback(
diff --git a/src/containers/datasets/habitat-extent/hooks.tsx b/src/containers/datasets/habitat-extent/hooks.tsx
index fc06329cf..c5b0d552e 100644
--- a/src/containers/datasets/habitat-extent/hooks.tsx
+++ b/src/containers/datasets/habitat-extent/hooks.tsx
@@ -43,7 +43,7 @@ export function useMangroveHabitatExtent(
const id = queryParams?.[1];
const {
data: { name: location, id: currentLocation, location_id },
- } = useLocation(locationType, id);
+ } = useLocation(id, locationType);
const { enabled: isAnalysisEnabled } = useRecoilValue(analysisAtom);
const { customGeojson } = useRecoilValue(drawingToolAtom);
const { uploadedGeojson } = useRecoilValue(drawingUploadToolAtom);
diff --git a/src/containers/datasets/height/hooks.tsx b/src/containers/datasets/height/hooks.tsx
index d374c81eb..a09bfc033 100644
--- a/src/containers/datasets/height/hooks.tsx
+++ b/src/containers/datasets/height/hooks.tsx
@@ -86,7 +86,7 @@ export function useMangroveHeight(
const id = queryParams?.[1];
const {
data: { name: location, id: currentLocation, location_id },
- } = useLocation(locationType, id);
+ } = useLocation(id, locationType);
const { customGeojson } = useRecoilValue(drawingToolAtom);
const { uploadedGeojson } = useRecoilValue(drawingUploadToolAtom);
const { enabled: isAnalysisEnabled } = useRecoilValue(analysisAtom);
diff --git a/src/containers/datasets/international-status/climate-watch/hooks.tsx b/src/containers/datasets/international-status/climate-watch/hooks.tsx
index 3b90ce872..5fbf07e08 100644
--- a/src/containers/datasets/international-status/climate-watch/hooks.tsx
+++ b/src/containers/datasets/international-status/climate-watch/hooks.tsx
@@ -25,7 +25,7 @@ export function useClimateWatchNDCS(
const id = queryParams?.[1];
const {
data: { iso },
- } = useLocation(locationType, id);
+ } = useLocation(id, locationType);
const fetchClimateWatchNDCS = () =>
ClimateWatchAPI.request({
@@ -71,7 +71,7 @@ export function useClimateWatchNDCSCountriesDocs(
const id = queryParams?.[1];
const {
data: { iso },
- } = useLocation(locationType, id);
+ } = useLocation(id, locationType);
const fetchClimateWatchNDCS = () =>
ClimateWatchAPI.request({
diff --git a/src/containers/datasets/international-status/frel-ipcc/hooks.tsx b/src/containers/datasets/international-status/frel-ipcc/hooks.tsx
index d79643adc..2fdd81297 100644
--- a/src/containers/datasets/international-status/frel-ipcc/hooks.tsx
+++ b/src/containers/datasets/international-status/frel-ipcc/hooks.tsx
@@ -27,7 +27,7 @@ export function useMangroveInternationalStatus(
const id = queryParams?.[1];
const {
data: { name: location, id: currentLocation, location_id },
- } = useLocation(locationType, id);
+ } = useLocation(id, locationType);
const fetchMangroveInternationalStatus = () =>
API.request({
diff --git a/src/containers/datasets/iucn-ecoregion/hooks.tsx b/src/containers/datasets/iucn-ecoregion/hooks.tsx
index 1673a7290..897dc604d 100644
--- a/src/containers/datasets/iucn-ecoregion/hooks.tsx
+++ b/src/containers/datasets/iucn-ecoregion/hooks.tsx
@@ -139,7 +139,7 @@ export function useMangroveEcoregions(
export function useSource(): SourceProps {
return {
- id: 'mangrove-iucn-ecoregion-layer',
+ id: 'mangrove-iucn-ecoregion',
type: 'vector',
url: 'mapbox://globalmangrovewatch.20gft2fx',
};
diff --git a/src/containers/datasets/locations/hooks.tsx b/src/containers/datasets/locations/hooks.tsx
index 4a2233b30..239c454f5 100644
--- a/src/containers/datasets/locations/hooks.tsx
+++ b/src/containers/datasets/locations/hooks.tsx
@@ -40,8 +40,8 @@ export function useLocations
(
}
export function useLocation(
- locationType: LocationTypes,
id: Location['location_id'],
+ locationType?: LocationTypes,
queryOptions: UseQueryOptions<{ data: DataResponse['data'][0] }, Error, Location> = {}
) {
const _id = ['wdpa', 'country'].includes(locationType) ? id : 'worldwide';
diff --git a/src/containers/datasets/national-dashboard/hooks.tsx b/src/containers/datasets/national-dashboard/hooks.tsx
index 490a99201..0d9ecf73c 100644
--- a/src/containers/datasets/national-dashboard/hooks.tsx
+++ b/src/containers/datasets/national-dashboard/hooks.tsx
@@ -28,8 +28,8 @@ export function useNationalDashboard(
const locationType = queryParams?.[0] as LocationTypes;
const id = queryParams?.[1];
const {
- data: { id: currentLocation, location_id },
- } = useLocation(locationType, id);
+ data: { id: currentLocation, location_id, iso },
+ } = useLocation(id, locationType);
const fetchMangroveNationalDashboard = () =>
API.request({
@@ -44,7 +44,7 @@ export function useNationalDashboard(
return useQuery(['national_dashboard', params, location_id], fetchMangroveNationalDashboard, {
select: (data) => ({
...data,
- location: currentLocation,
+ locationIso: iso,
}),
...queryOptions,
});
@@ -74,12 +74,13 @@ export function useLayers({
query: { params: queryParams },
} = useRouter();
const locationType = queryParams?.[0] as LocationTypes;
- const locationId = queryParams?.[1];
+ const location = queryParams?.[1];
+
const {
- data: { id: currentLocationId },
- } = useLocation(locationType, locationId);
+ data: { iso },
+ } = useLocation(location, locationType);
- if (!settings || settings.locationId !== currentLocationId) return null;
+ if (!settings || settings.location !== iso) return null;
return {
id,
diff --git a/src/containers/datasets/national-dashboard/indicator-source/index.tsx b/src/containers/datasets/national-dashboard/indicator-source/index.tsx
index 6fc16619f..01e735c53 100644
--- a/src/containers/datasets/national-dashboard/indicator-source/index.tsx
+++ b/src/containers/datasets/national-dashboard/indicator-source/index.tsx
@@ -1,7 +1,4 @@
import { useMemo, useCallback } from 'react';
-import { useEffect } from 'react';
-
-import { useRouter } from 'next/router';
import cn from 'lib/classnames';
import { numberFormat } from 'lib/format';
@@ -10,9 +7,6 @@ import { activeLayersAtom } from 'store/layers';
import { useRecoilState } from 'recoil';
-import { useLocation } from 'containers/datasets/locations/hooks';
-import type { LocationTypes } from 'containers/datasets/locations/types';
-
import Icon from 'components/icon';
import { Popover, PopoverContent, PopoverTrigger } from 'components/popover';
import { SwitchWrapper, SwitchRoot, SwitchThumb } from 'components/switch';
@@ -38,7 +32,7 @@ type DataSourceTypes = {
type IndicatorSourceTypes = {
id: WidgetSlugType;
- location: number;
+ locationIso: string;
layerIndex: number;
source: string;
years: number[];
@@ -52,7 +46,7 @@ type IndicatorSourceTypes = {
const IndicatorSource = ({
id,
source,
- location,
+ locationIso,
layerIndex,
years,
unit,
@@ -64,35 +58,9 @@ const IndicatorSource = ({
const [activeLayers, setActiveLayers] = useRecoilState(activeLayersAtom);
const activeLayersIds = activeLayers.map((l) => l.id);
const isActive = useMemo(() => activeLayersIds.includes(id), [activeLayersIds, id]);
- const natDashLayer = useMemo(() => activeLayers.find((l) => l.id === id), [activeLayers, id]);
- const {
- query: { params: queryParams },
- } = useRouter();
- const locationType = queryParams?.[0] as LocationTypes;
- const locationId = queryParams?.[1];
- const {
- data: { id: currentLocationId },
- } = useLocation(locationType, locationId);
-
- useEffect(() => {
- const isNationalDashboardActive = activeLayers.find(
- (layer) => layer.id === 'mangrove_national_dashboard_layer'
- );
- if (
- isNationalDashboardActive &&
- Number(location) !== isNationalDashboardActive.settings?.locationId
- ) {
- const updatedLayers = activeLayers.filter(
- (layer) => layer.id !== 'mangrove_national_dashboard_layer'
- );
- setActiveLayers(updatedLayers);
- }
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, []);
-
const handleClick = useCallback(() => {
const layersUpdate = isActive
- ? activeLayers.filter((w) => w.id !== id)
+ ? activeLayers.filter((w) => !w.id.includes('mangrove_national_dashboard_layer'))
: ([
{
id,
@@ -100,7 +68,7 @@ const IndicatorSource = ({
visibility: 'visible',
settings: {
name: source,
- locationId: location,
+ location: locationIso,
layerIndex,
source: dataSource.layer_link,
source_layer: dataSource.source_layer || DATA_SOURCES[dataSource.layer_link],
@@ -109,7 +77,7 @@ const IndicatorSource = ({
...activeLayers,
] as ActiveLayers[]);
setActiveLayers(layersUpdate);
- }, [activeLayers, setActiveLayers, id]);
+ }, [activeLayers, setActiveLayers, id, dataSource, isActive, layerIndex, locationIso, source]);
return (
@@ -133,15 +101,14 @@ const IndicatorSource = ({
-
-
+
+
{years?.map((u) => (
- -
+
-
-
{dataSource?.value && (
{numberFormat(dataSource.value)}
@@ -170,12 +136,8 @@ const IndicatorSource = ({
info: dataSource?.layer_info,
}}
/>
-
-
+
+
diff --git a/src/containers/datasets/national-dashboard/widget.tsx b/src/containers/datasets/national-dashboard/widget.tsx
index f8a49330a..7f894adff 100644
--- a/src/containers/datasets/national-dashboard/widget.tsx
+++ b/src/containers/datasets/national-dashboard/widget.tsx
@@ -6,6 +6,8 @@ import cn from 'lib/classnames';
import chroma from 'chroma-js';
+import { useLocation } from 'containers/datasets/locations/hooks';
+
import Loading from 'components/loading';
import { WIDGET_CARD_WRAPPER_STYLE, WIDGET_SUBTITLE_STYLE } from 'styles/widgets';
@@ -46,7 +48,6 @@ const NationalDashboard = () => {
{sources.map(({ source, years, unit, data_source }) => {
const dataSource = data_source.find((d) => d.year === currentYear);
const color = colorsScale.filter((c, i) => i === index);
-
return (
<>
@@ -56,8 +57,8 @@ const NationalDashboard = () => {
diff --git a/src/containers/datasets/restoration-sites/hooks.tsx b/src/containers/datasets/restoration-sites/hooks.tsx
index 9b17013ce..d4542b205 100644
--- a/src/containers/datasets/restoration-sites/hooks.tsx
+++ b/src/containers/datasets/restoration-sites/hooks.tsx
@@ -32,7 +32,7 @@ export function useMangroveRestorationSites(
const id = queryParams?.[1];
const {
data: { name: location, id: currentLocation, location_id },
- } = useLocation(locationType, id);
+ } = useLocation(id, locationType);
const mapFilters = useRecoilValue(RestorationSitesMapFilters);
const filtersPending = useRecoilValue(RestorationSitesFiltersApplication);
@@ -71,7 +71,7 @@ export function useMangroveRestorationSitesFilters(
const id = queryParams?.[1];
const {
data: { id: currentLocation, location_id },
- } = useLocation(locationType, id);
+ } = useLocation(id, locationType);
const fetchMangroveRestorationSitesFilters = () =>
API.request({
method: 'GET',
diff --git a/src/containers/datasets/restoration/fisheries/hooks.tsx b/src/containers/datasets/restoration/fisheries/hooks.tsx
index 41e057d68..1b68d83d3 100644
--- a/src/containers/datasets/restoration/fisheries/hooks.tsx
+++ b/src/containers/datasets/restoration/fisheries/hooks.tsx
@@ -30,7 +30,7 @@ export function useMangroveEcosystemServices(
const id = queryParams?.[1];
const {
data: { id: currentLocation, location_id },
- } = useLocation(locationType, id);
+ } = useLocation(id, locationType);
const fetchMangroveEcosystemServices = () =>
API.request({
diff --git a/src/containers/datasets/restoration/loss/hooks.tsx b/src/containers/datasets/restoration/loss/hooks.tsx
index 56f445588..5478c839b 100644
--- a/src/containers/datasets/restoration/loss/hooks.tsx
+++ b/src/containers/datasets/restoration/loss/hooks.tsx
@@ -64,7 +64,7 @@ export function useMangroveDegradationAndLoss(
const id = queryParams?.[1];
const {
data: { name: location, id: currentLocation, location_id },
- } = useLocation(locationType, id);
+ } = useLocation(id, locationType);
const fetchMangroveDegradationAndLoss = () =>
API.request({
method: 'GET',
diff --git a/src/containers/datasets/restoration/overview/hooks.tsx b/src/containers/datasets/restoration/overview/hooks.tsx
index ab12ddb8b..76ed98303 100644
--- a/src/containers/datasets/restoration/overview/hooks.tsx
+++ b/src/containers/datasets/restoration/overview/hooks.tsx
@@ -27,7 +27,7 @@ export function useMangroveRestoration(
const id = queryParams?.[1];
const {
data: { name: location, id: currentLocation, location_id },
- } = useLocation(locationType, id);
+ } = useLocation(id, locationType);
const fetchMangroveRestoration = () =>
API.request({
diff --git a/src/containers/datasets/restoration/restoration-value/hooks.tsx b/src/containers/datasets/restoration/restoration-value/hooks.tsx
index 36f3b013d..71a9fbfb4 100644
--- a/src/containers/datasets/restoration/restoration-value/hooks.tsx
+++ b/src/containers/datasets/restoration/restoration-value/hooks.tsx
@@ -24,7 +24,7 @@ export function useMangroveEcosystemServices(
const id = queryParams?.[1];
const {
data: { name: location, id: currentLocation, location_id },
- } = useLocation(locationType, id);
+ } = useLocation(id, locationType);
const fetchMangroveEcosystemServices = () =>
API.request({
method: 'GET',
diff --git a/src/containers/datasets/species-distribution/hooks.tsx b/src/containers/datasets/species-distribution/hooks.tsx
index d453cbf41..5b4ad8523 100644
--- a/src/containers/datasets/species-distribution/hooks.tsx
+++ b/src/containers/datasets/species-distribution/hooks.tsx
@@ -29,7 +29,7 @@ export function useMangroveSpecies(
const id = queryParams?.[1];
const {
data: { name: location, id: currentLocation, location_id },
- } = useLocation(locationType, id);
+ } = useLocation(id, locationType);
const fetchMangroveSpecies = () =>
API.request({
method: 'GET',
diff --git a/src/containers/datasets/species-location/hooks.tsx b/src/containers/datasets/species-location/hooks.tsx
index 70dfe1950..03d6b0df6 100644
--- a/src/containers/datasets/species-location/hooks.tsx
+++ b/src/containers/datasets/species-location/hooks.tsx
@@ -41,7 +41,7 @@ export function useMangroveSpeciesLocation(
const id = queryParams?.[1];
const {
data: { id: currentLocation, location_id },
- } = useLocation(locationType, id);
+ } = useLocation(id, locationType);
return useQuery([QUERY_KEY, location_id], fetchMangroveSpecies, {
placeholderData: queryClient.getQueryData([QUERY_KEY, location_id]) || {
diff --git a/src/containers/datasets/species-location/widget.tsx b/src/containers/datasets/species-location/widget.tsx
index ed5ad84c1..abec4ffa5 100644
--- a/src/containers/datasets/species-location/widget.tsx
+++ b/src/containers/datasets/species-location/widget.tsx
@@ -35,7 +35,7 @@ const SpeciesLocation = () => {
const id = queryParams?.[1];
const {
data: { name: location },
- } = useLocation(locationType, id);
+ } = useLocation(id, locationType);
const [specieSelected, setSpecie] =
useRecoilState(SpeciesLocationState);
diff --git a/src/containers/datasets/species-threatened/hooks.tsx b/src/containers/datasets/species-threatened/hooks.tsx
index b7a362b26..b22f8a167 100644
--- a/src/containers/datasets/species-threatened/hooks.tsx
+++ b/src/containers/datasets/species-threatened/hooks.tsx
@@ -81,7 +81,7 @@ export function useMangroveSpecies(
const id = queryParams?.[1];
const {
data: { name: location, id: currentLocation, location_id },
- } = useLocation(locationType, id);
+ } = useLocation(id, locationType);
const fetchMangroveSpecies = () =>
API.request({
diff --git a/src/containers/location-widget/index.tsx b/src/containers/location-widget/index.tsx
index d47f42974..d0d047b06 100644
--- a/src/containers/location-widget/index.tsx
+++ b/src/containers/location-widget/index.tsx
@@ -27,7 +27,7 @@ const LocationWidget = () => {
const id = params?.[1];
const {
data: { name },
- } = useLocation(locationType, id, {
+ } = useLocation(id, locationType, {
enabled: (!!locationType && !!id) || locationType !== 'custom-area',
});
diff --git a/src/containers/locations-list/mobile/highlighted-places/index.tsx b/src/containers/locations-list/mobile/highlighted-places/index.tsx
index f97cd17ff..7db07cf57 100644
--- a/src/containers/locations-list/mobile/highlighted-places/index.tsx
+++ b/src/containers/locations-list/mobile/highlighted-places/index.tsx
@@ -22,7 +22,7 @@ const HighlightedPlacesMobile = () => {
const {
data: { location_id },
- } = useLocation(locationType, id);
+ } = useLocation(id, locationType);
const isHighlightedPlace = Object.values(HIGHLIGHTED_PLACES).includes(location_id);
const formatToKm = (mts) => {
diff --git a/src/containers/map/index.tsx b/src/containers/map/index.tsx
index 6c8358325..3e71bbe8e 100644
--- a/src/containers/map/index.tsx
+++ b/src/containers/map/index.tsx
@@ -231,7 +231,7 @@ const MapContainer = ({ mapId }: { mapId: string }) => {
);
const iucnEcoregionFeature = e?.features.find(
- ({ layer }) => layer.id === 'mangrove-iucn-ecoregion-layer'
+ ({ layer }) => layer.id === 'mangrove_iucn_ecoregion-layer'
);
if (locationFeature) {
diff --git a/src/containers/map/layer-manager/index.tsx b/src/containers/map/layer-manager/index.tsx
index 6884dc195..0edd20686 100644
--- a/src/containers/map/layer-manager/index.tsx
+++ b/src/containers/map/layer-manager/index.tsx
@@ -4,7 +4,6 @@ import { Layer } from 'react-map-gl';
import { activeLayersAtom } from 'store/layers';
import { interactiveLayerIdsAtom } from 'store/map';
-import { basemapContextualAtom } from 'store/map-settings';
import { useRecoilState, useRecoilValue } from 'recoil';
@@ -13,38 +12,24 @@ import { LAYERS, BASEMAPS } from 'containers/datasets';
import type { LayerProps } from 'types/layers';
import type { ContextualBasemapsId, WidgetSlugType } from 'types/widget';
-const RestorationLayer = LAYERS['mangrove_restoration'];
const CountryBoundariesLayer = LAYERS['country-boundaries'];
-const RestorationSitesLayer = LAYERS['mangrove_restoration_sites'];
-const IucnEcoregionLayer = LAYERS['mangrove_iucn_ecoregion'];
-
-const EXCLUDED_DATA_LAYERS: (WidgetSlugType | ContextualBasemapsId)[] = [
- 'mangrove_restoration_sites',
- 'mangrove_restoration',
- 'mangrove_iucn_ecoregion',
-] satisfies (WidgetSlugType | ContextualBasemapsId)[];
const LayerManagerContainer = () => {
const layers = useRecoilValue(activeLayersAtom);
- const layersIds = layers.map((l) => l.id);
- const basemap = useRecoilValue(basemapContextualAtom);
const [, setInteractiveLayerIds] = useRecoilState(interactiveLayerIdsAtom);
const activeLayersIds = layers.map((l) => l.id);
const LAYERS_FILTERED = useMemo(() => {
const filteredLayers = activeLayersIds.filter(
- (layer: WidgetSlugType & ContextualBasemapsId & 'custom-area') =>
- !EXCLUDED_DATA_LAYERS.includes(layer) && !!LAYERS[layer]
+ (layer: WidgetSlugType | ContextualBasemapsId | 'custom-area') => {
+ return Object.keys(LAYERS).some((k) => layer.includes(k));
+ }
);
- // if (!!basemap) {
- // filteredLayers.push(basemap);
- // }
-
return filteredLayers;
- }, [activeLayersIds, basemap]);
+ }, [activeLayersIds]);
const handleAdd = useCallback(
(styleIds: LayerProps['id'][]) => {
@@ -92,7 +77,9 @@ const LayerManagerContainer = () => {
})}
{LAYERS_FILTERED.map((layer, i) => {
- const LayerComponent = LAYERS[layer] || BASEMAPS[layer];
+ const layerId = Object.keys(LAYERS).find((k) => layer.includes(k));
+
+ const LayerComponent = LAYERS[layerId] || BASEMAPS[layerId];
const beforeId = i === 0 ? 'custom-layers' : `${LAYERS_FILTERED[i - 1]}-bg`;
return (
{
onRemove={handleRemove}
/>
}
-
- {layersIds.includes('mangrove_restoration_sites') && (
-
- )}
-
- {layersIds.includes('mangrove_restoration') && (
-
- )}
-
- {layersIds.includes('mangrove_iucn_ecoregion') && (
-
- )}
>
);
};
diff --git a/src/containers/map/legend/index.tsx b/src/containers/map/legend/index.tsx
index eeb32d7c9..5fc5bd343 100644
--- a/src/containers/map/legend/index.tsx
+++ b/src/containers/map/legend/index.tsx
@@ -55,8 +55,8 @@ const Legend = ({ embedded = false }: { embedded?: boolean }) => {
[activeLayers, setActiveLayers]
);
- const nationalDashboardLayerName = activeLayers.find(
- (l) => l.id === 'mangrove_national_dashboard_layer'
+ const nationalDashboardLayerName = activeLayers.find((l) =>
+ l.id.includes('mangrove_national_dashboard_layer')
)?.settings?.name;
const removeLayer = useCallback(
@@ -150,13 +150,12 @@ const Legend = ({ embedded = false }: { embedded?: boolean }) => {
{activeLayers.map((l) => {
if (l.id === 'custom-area') return null;
+ const layerId = Object.keys(MAP_LEGENDS).find((k) => l.id.includes(k));
+ const WidgetLegend = MAP_LEGENDS[layerId] as React.ElementType;
- const WidgetLegend = MAP_LEGENDS[l.id] as React.ElementType;
-
- const widgetId =
- l.id === 'mangrove_national_dashboard_layer'
- ? 'mangrove_national_dashboard'
- : l.id;
+ const widgetId = l.id.includes('mangrove_national_dashboard_layer')
+ ? 'mangrove_national_dashboard'
+ : l.id;
const Widget = WIDGETS[widgetId] as React.ElementType;
@@ -165,12 +164,13 @@ const Legend = ({ embedded = false }: { embedded?: boolean }) => {
const layerNameToDisplay = layerName(l.id);
if (
layerNameToDisplay === undefined &&
- l.id !== 'mangrove_national_dashboard_layer'
+ !l.id.includes('mangrove_national_dashboard_layer')
)
return null;
const title =
- l.id === 'mangrove_national_dashboard_layer' && nationalDashboardLayerName
+ l.id.includes('mangrove_national_dashboard_layer') &&
+ nationalDashboardLayerName
? `National Dashboard`
: layerNameToDisplay;
diff --git a/src/containers/map/mobile/legend/index.tsx b/src/containers/map/mobile/legend/index.tsx
index 943d1c8c4..82b4ebf39 100644
--- a/src/containers/map/mobile/legend/index.tsx
+++ b/src/containers/map/mobile/legend/index.tsx
@@ -158,12 +158,13 @@ const Legend = () => {
const layerNameToDisplay = layerName(l.id);
if (
layerNameToDisplay === undefined &&
- l.id !== 'mangrove_national_dashboard_layer'
+ !l.id.includes('mangrove_national_dashboard_layer')
)
return null;
const title =
- l.id === 'mangrove_national_dashboard_layer' && nationalDashboardLayerName
+ l.id.includes('mangrove_national_dashboard_layer') &&
+ nationalDashboardLayerName
? `National Dashboard`
: layerNameToDisplay;
diff --git a/src/layouts/desktop/index.tsx b/src/layouts/desktop/index.tsx
index 2bfd3d66e..0edde3993 100644
--- a/src/layouts/desktop/index.tsx
+++ b/src/layouts/desktop/index.tsx
@@ -29,7 +29,7 @@ const DesktopLayout = () => {
const {
data: { name: location },
- } = useLocation(locationType, id);
+ } = useLocation(id, locationType);
return (
diff --git a/src/store/layers/index.ts b/src/store/layers/index.ts
index f5c0ec406..ef61c479f 100644
--- a/src/store/layers/index.ts
+++ b/src/store/layers/index.ts
@@ -10,7 +10,7 @@ const LayerSettings = object({
source: optional(string()),
source_layer: optional(string()),
date: optional(string()),
- locationId: optional(number()),
+ location: optional(string()),
layerIndex: optional(number()),
});
@@ -33,7 +33,7 @@ export const activeLayersAtom = atom<
name?: string;
source?: string;
source_layer?: string;
- locationId?: number;
+ location?: string;
layerIndex?: number;
date?: string;
[key: string]: string | number;
diff --git a/src/types/widget.ts b/src/types/widget.ts
index 7e2702296..4f0a00f65 100644
--- a/src/types/widget.ts
+++ b/src/types/widget.ts
@@ -39,7 +39,7 @@ export type WidgetSlugType =
| 'mangrove_coastal_protection_area'
| 'mangrove_coastal_protection_population'
| 'mangrove_coastal_protection_stock'
- | 'mangrove_national_dashboard_layer'
+ | `mangrove_national_dashboard_layer_${string}`
| 'mangrove_protected_areas'
| 'mangrove_iucn_ecoregion'
| 'mangrove_allen_coral_reef'