-
-
-
- {/*
-
- */}
-
{(onHover || onClick) && (
)}
+ {baseLayers}
>
)}
/>
diff --git a/app/src/components/domain/RiskImminentEventMap/index.tsx b/app/src/components/domain/RiskImminentEventMap/index.tsx
index 9622417d65..88d0a532e5 100644
--- a/app/src/components/domain/RiskImminentEventMap/index.tsx
+++ b/app/src/components/domain/RiskImminentEventMap/index.tsx
@@ -29,7 +29,7 @@ import type {
SymbolLayer,
} from 'mapbox-gl';
-import BaseMap from '#components/domain/BaseMap';
+import GlobalMap from '#components/domain/GlobalMap';
import MapContainerWithDisclaimer from '#components/MapContainerWithDisclaimer';
import { type components } from '#generated/riskTypes';
import useDebouncedValue from '#hooks/useDebouncedValue';
@@ -347,7 +347,7 @@ function RiskImminentEventMap<
return (
-
)}
-
+
;
- lngLat: mapboxgl.LngLatLike;
-}
-
-interface GeoJsonProps {
- country_id: number;
- disputed: boolean;
- fdrs: string;
- independent: boolean;
- is_deprecated: boolean;
- iso: string;
- iso3: string;
- name: string;
- record_type: number;
- region_id: number;
+ properties: AdminZeroFeatureProperties;
+ lngLat: LngLatLike;
}
type BaseProps = {
@@ -813,55 +798,49 @@ function RiskSeasonalMap(props: Props) {
// NOTE: we need to generate the layerOptions because we cannot use MapState
// The id in the vector tile does not match the id in GO
// We also cannot use promoteId as it is a non-managed mapbox source
- const layerOptions = useMemo>(
+ const paintOptions = useMemo(
() => {
if (isNotDefined(filteredData) || filteredData.length === 0) {
return {
- type: 'fill',
- paint: {
- 'fill-color': COLOR_LIGHT_GREY,
- },
+ 'fill-color': COLOR_LIGHT_GREY,
};
}
return {
- type: 'fill',
- paint: {
- 'fill-color': [
- 'match',
- ['get', 'iso3'],
- ...filteredData.flatMap(
- (item) => [
- item.country_details.iso3.toUpperCase(),
- [
- 'interpolate',
- ['linear'],
- ['number', item.riskCategory],
- CATEGORY_RISK_VERY_LOW,
- COLOR_LIGHT_BLUE,
- CATEGORY_RISK_VERY_HIGH,
- COLOR_PRIMARY_RED,
- ],
+ 'fill-color': [
+ 'match',
+ ['get', 'iso3'],
+ ...filteredData.flatMap(
+ (item) => [
+ item.country_details.iso3.toUpperCase(),
+ [
+ 'interpolate',
+ ['linear'],
+ ['number', item.riskCategory],
+ CATEGORY_RISK_VERY_LOW,
+ COLOR_LIGHT_BLUE,
+ CATEGORY_RISK_VERY_HIGH,
+ COLOR_PRIMARY_RED,
],
- ),
- COLOR_LIGHT_GREY,
- ],
- 'fill-outline-color': [
- 'case',
- ['boolean', ['feature-state', 'hovered'], false],
- COLOR_DARK_GREY,
- 'transparent',
- ],
- },
+ ],
+ ),
+ COLOR_LIGHT_GREY,
+ ],
+ 'fill-outline-color': [
+ 'case',
+ ['boolean', ['feature-state', 'hovered'], false],
+ COLOR_DARK_GREY,
+ 'transparent',
+ ],
};
},
[filteredData],
);
const handleCountryClick = useCallback(
- (feature: mapboxgl.MapboxGeoJSONFeature, lngLat: mapboxgl.LngLat) => {
+ (properties: AdminZeroFeatureProperties, lngLat: LngLatLike) => {
setClickedPointProperties({
- feature: feature as unknown as ClickedPoint['feature'],
+ properties,
lngLat,
});
return true;
@@ -879,7 +858,7 @@ function RiskSeasonalMap(props: Props) {
const riskPopupValue = useMemo(() => (
filteredData?.find(
(filter) => filter.iso3 === clickedPointProperties
- ?.feature.properties.iso3.toLowerCase(),
+ ?.properties.iso3.toLowerCase(),
)
), [filteredData, clickedPointProperties]);
@@ -952,15 +931,9 @@ function RiskSeasonalMap(props: Props) {
)}
>
-
- )}
+
- {clickedPointProperties.feature.properties.name}
+ {clickedPointProperties.properties.name}
)}
contentViewType="vertical"
@@ -994,7 +967,7 @@ function RiskSeasonalMap(props: Props) {
/>
)}
-
+