@@ -23,7 +23,7 @@ import {
2323 MapSource ,
2424} from '@togglecorp/re-map' ;
2525
26- import BaseMap from '#components/domain/BaseMap ' ;
26+ import GlobalMap , { type AdminZeroFeatureProperties } from '#components/domain/GlobalMap ' ;
2727import Link from '#components/Link' ;
2828import MapContainerWithDisclaimer from '#components/MapContainerWithDisclaimer' ;
2929import MapPopup from '#components/MapPopup' ;
@@ -32,7 +32,6 @@ import useInputState from '#hooks/useInputState';
3232import { useRequest } from '#utils/restRequest' ;
3333
3434import {
35- adminFillLayerOptions ,
3635 basePointLayerOptions ,
3736 getLegendOptions ,
3837 getScaleOptions ,
@@ -52,24 +51,8 @@ const sourceOptions: mapboxgl.GeoJSONSourceRaw = {
5251 type : 'geojson' ,
5352} ;
5453
55- interface CountryProperties {
56- country_id : number ;
57- disputed : boolean ;
58- fdrs : string ;
59- independent : boolean ;
60- is_deprecated : boolean ;
61- iso : string ;
62- iso3 : string ;
63- name : string ;
64- name_ar : string ;
65- name_es : string ;
66- name_fr : string ;
67- record_type : number ;
68- region_id : number ;
69- }
70-
7154interface ClickedPoint {
72- feature : GeoJSON . Feature < GeoJSON . Point , CountryProperties > ;
55+ properties : AdminZeroFeatureProperties ;
7356 lngLat : mapboxgl . LngLatLike ;
7457}
7558
@@ -206,7 +189,7 @@ function SurgeMap(props: Props) {
206189 ? {
207190 eruDeployedEvents : mapToList (
208191 listToGroupList (
209- countryGroupedErus [ clickedPointProperties . feature . properties . country_id ] ?? [ ] ,
192+ countryGroupedErus [ clickedPointProperties . properties . country_id ] ?? [ ] ,
210193 ( eru ) => eru . event . id ?? - 1 ,
211194 ) ,
212195 ( eru ) => ( {
@@ -216,8 +199,7 @@ function SurgeMap(props: Props) {
216199 ) ,
217200 personnelDeployedEvents : mapToList (
218201 listToGroupList (
219- // eslint-disable-next-line max-len
220- countryGroupedPersonnel ?. [ clickedPointProperties . feature . properties . country_id ] ?? [ ] ,
202+ countryGroupedPersonnel ?. [ clickedPointProperties . properties . country_id ] ?? [ ] ,
221203 ( personnel ) => personnel . event . id ,
222204 ) ,
223205 ( personnel ) => ( {
@@ -229,11 +211,11 @@ function SurgeMap(props: Props) {
229211 : undefined ;
230212
231213 const handleCountryClick = useCallback ( (
232- feature : mapboxgl . MapboxGeoJSONFeature ,
214+ properties : AdminZeroFeatureProperties ,
233215 lngLat : mapboxgl . LngLatLike ,
234216 ) => {
235217 setClickedPointProperties ( {
236- feature : feature as unknown as ClickedPoint [ 'feature' ] ,
218+ properties ,
237219 lngLat,
238220 } ) ;
239221 return false ;
@@ -250,15 +232,8 @@ function SurgeMap(props: Props) {
250232 < Container
251233 className = { _cs ( styles . surgeMap , className ) }
252234 >
253- < BaseMap
254- baseLayers = { (
255- < MapLayer
256- layerKey = "admin-0"
257- hoverable
258- layerOptions = { adminFillLayerOptions }
259- onClick = { handleCountryClick }
260- />
261- ) }
235+ < GlobalMap
236+ onAdminZeroFillClick = { handleCountryClick }
262237 >
263238 < MapContainerWithDisclaimer
264239 className = { styles . mapContainer }
@@ -316,10 +291,10 @@ function SurgeMap(props: Props) {
316291 < Link
317292 to = "countriesLayout"
318293 urlParams = { {
319- countryId : clickedPointProperties . feature . properties . country_id ,
294+ countryId : clickedPointProperties . properties . country_id ,
320295 } }
321296 >
322- { clickedPointProperties . feature . properties . name }
297+ { clickedPointProperties . properties . name }
323298 </ Link >
324299 ) }
325300 childrenContainerClassName = { styles . popupContent }
@@ -368,7 +343,7 @@ function SurgeMap(props: Props) {
368343 ) }
369344 </ MapPopup >
370345 ) }
371- </ BaseMap >
346+ </ GlobalMap >
372347 </ Container >
373348 ) ;
374349}
0 commit comments