11import { useMemo } from 'react' ;
2- // import { LanguageContext } from '@ifrc-go/ui/contexts';
32import { ErrorBoundary } from '@sentry/react' ;
43import {
54 isDefined ,
@@ -29,6 +28,8 @@ type overrides = 'mapStyle' | 'mapOptions' | 'navControlShown' | 'navControlPosi
2928export type Props = Omit < MapProps , overrides > & {
3029 baseLayers ?: React . ReactNode ;
3130 withDisclaimer ?: boolean ;
31+ // NOTE: Labels with be added from the country information instead of the
32+ // mapbox layers
3233 withoutLabel ?: boolean ;
3334} & Partial < Pick < MapProps , overrides > > ;
3435
@@ -76,6 +77,7 @@ function BaseMap(props: Props) {
7677
7778 const countries = useCountry ( ) ;
7879
80+ // FIXME: We should check for special cases like ICRC, IFRC, etc.
7981 const countryCentroidGeoJson = useMemo (
8082 ( ) : GeoJSON . FeatureCollection < GeoJSON . Geometry > => ( {
8183 type : 'FeatureCollection' as const ,
@@ -101,34 +103,6 @@ function BaseMap(props: Props) {
101103 [ countries ] ,
102104 ) ;
103105
104- // const { currentLanguage } = useContext(LanguageContext);
105-
106- /*
107- const adminLabelLayerOptions : Omit<SymbolLayer, 'id'> = useMemo(
108- () => {
109- // ar, es, fr
110- let label: string;
111- if (currentLanguage === 'es') {
112- label = 'name_es';
113- } else if (currentLanguage === 'ar') {
114- label = 'name_ar';
115- } else if (currentLanguage === 'fr') {
116- label = 'name_fr';
117- } else {
118- label = 'name';
119- }
120-
121- return {
122- type: 'symbol',
123- layout: {
124- 'text-field': ['get', label],
125- },
126- };
127- },
128- [currentLanguage],
129- );
130- */
131-
132106 return (
133107 < Map
134108 mapStyle = { mapStyle ?? defaultMapStyle }
@@ -153,7 +127,7 @@ function BaseMap(props: Props) {
153127 geoJson = { countryCentroidGeoJson }
154128 >
155129 < MapLayer
156- layerKey = "point-circle "
130+ layerKey = "symbol-label "
157131 layerOptions = { adminLabelOverrideOptions }
158132 />
159133 </ MapSource >
0 commit comments