Skip to content

Commit bcbd660

Browse files
committed
Add comments on why z-index was changed
- Revert back usage of GlobalMap on RiskImminentEventMap
1 parent 2bd4414 commit bcbd660

File tree

3 files changed

+10
-32
lines changed

3 files changed

+10
-32
lines changed

app/src/components/domain/BaseMap/index.tsx

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { useMemo } from 'react';
2-
// import { LanguageContext } from '@ifrc-go/ui/contexts';
32
import { ErrorBoundary } from '@sentry/react';
43
import {
54
isDefined,
@@ -29,6 +28,8 @@ type overrides = 'mapStyle' | 'mapOptions' | 'navControlShown' | 'navControlPosi
2928
export 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>

app/src/components/domain/GlobalMap/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,15 @@ function GlobalMap(props: Props) {
114114
const fillSortKey = useMemo<number | Expression>(() => [
115115
'match',
116116
['get', 'iso3'],
117+
// NOTE: Hovered geoarea should be at the top
117118
hoveredCountryIso3 ?? '???',
118119
2,
120+
// NOTE: After that, we should have geoarea that is 100%
121+
// included in another geoarea
119122
...(overlappedDisputedCountriesIso3.filter(
120123
(iso3) => !(iso3 === hoveredCountryIso3),
121124
).flatMap((iso3) => [iso3, 1])),
125+
// NOTE: Everything else should be after that
122126
0,
123127
], [hoveredCountryIso3]);
124128

app/src/components/domain/RiskImminentEventMap/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import type {
2929
SymbolLayer,
3030
} from 'mapbox-gl';
3131

32+
import BaseMap from '#components/domain/BaseMap';
3233
import MapContainerWithDisclaimer from '#components/MapContainerWithDisclaimer';
3334
import { type components } from '#generated/riskTypes';
3435
import useDebouncedValue from '#hooks/useDebouncedValue';
@@ -38,7 +39,6 @@ import {
3839
DURATION_MAP_ZOOM,
3940
} from '#utils/constants';
4041

41-
import GlobalMap from '../GlobalMap';
4242
import LayerOptions, { type LayerOptionsValue } from './LayerOptions';
4343
import {
4444
activeHazardPointLayer,
@@ -347,7 +347,7 @@ function RiskImminentEventMap<
347347

348348
return (
349349
<div className={styles.riskImminentEventMap}>
350-
<GlobalMap
350+
<BaseMap
351351
mapOptions={{ bounds }}
352352
>
353353
<MapContainerWithDisclaimer

0 commit comments

Comments
 (0)