Skip to content

Commit d85f64d

Browse files
tnagorrafrozenhelium
authored andcommitted
Hide WFPAdam in RiskWatch on production
- Show exposure control only for GDACs source
1 parent a5ad667 commit d85f64d

File tree

8 files changed

+73
-47
lines changed

8 files changed

+73
-47
lines changed

.changeset/swift-humans-occur.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"go-web-app": patch
3+
---
4+
5+
Update Imminent Events
6+
7+
- Hide WFP ADAM temporarily from list sources
8+
- Show exposure control for cyclones from GDACS only

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

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,13 @@ function colorSelector(item: SeverityLegendItem) {
4343
interface Props {
4444
value: LayerOptionsValue;
4545
onChange: React.Dispatch<React.SetStateAction<LayerOptionsValue>>;
46+
47+
exposureAreaControlHidden?: boolean;
4648
}
4749

4850
function LayerOptions(props: Props) {
4951
const {
52+
exposureAreaControlHidden,
5053
value,
5154
onChange,
5255
} = props;
@@ -92,28 +95,30 @@ function LayerOptions(props: Props) {
9295
withBackground
9396
withInvertedView
9497
/>
95-
<div className={styles.exposedAreaInputWrapper}>
96-
<Switch
97-
// FIXME: use strings
98-
label="Exposed area to tropical storm or cyclone strength wind"
99-
name="showExposedArea"
100-
value={value.showExposedArea}
101-
onChange={setFieldValue}
102-
withInvertedView
103-
/>
104-
{value.showExposedArea && (
105-
<Legend
106-
className={styles.exposedAreaLegend}
98+
{!exposureAreaControlHidden && (
99+
<div className={styles.exposedAreaInputWrapper}>
100+
<Switch
107101
// FIXME: use strings
108-
label="Severity:"
109-
items={severityLegendItems}
110-
keySelector={severitySelector}
111-
labelSelector={labelSelector}
112-
colorSelector={colorSelector}
113-
labelClassName={styles.legendLabel}
102+
label="Exposed area to tropical storm or cyclone strength wind"
103+
name="showExposedArea"
104+
value={value.showExposedArea}
105+
onChange={setFieldValue}
106+
withInvertedView
114107
/>
115-
)}
116-
</div>
108+
{value.showExposedArea && (
109+
<Legend
110+
className={styles.exposedAreaLegend}
111+
// FIXME: use strings
112+
label="Severity:"
113+
items={severityLegendItems}
114+
keySelector={severitySelector}
115+
labelSelector={labelSelector}
116+
colorSelector={colorSelector}
117+
labelClassName={styles.legendLabel}
118+
/>
119+
)}
120+
</div>
121+
)}
117122
<Switch
118123
// FIXME: use strings
119124
label="Storm track"

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,11 @@ export interface RiskEventDetailProps<EVENT, EXPOSURE> {
9999

100100
type Footprint = GeoJSON.FeatureCollection<GeoJSON.Geometry, RiskLayerProperties> | undefined;
101101

102+
// FIXME: read this from common type
103+
export type ImminentEventSource = 'pdc' | 'wfpAdam' | 'gdacs' | 'meteoSwiss';
104+
102105
interface Props<EVENT, EXPOSURE, KEY extends string | number> {
106+
source: ImminentEventSource;
103107
events: EVENT[] | undefined;
104108
keySelector: (event: EVENT) => KEY;
105109
hazardTypeSelector: (event: EVENT) => HazardType | '' | undefined;
@@ -134,6 +138,7 @@ function RiskImminentEventMap<
134138
bbox,
135139
onActiveEventChange,
136140
activeEventExposurePending,
141+
source,
137142
} = props;
138143

139144
const strings = useTranslation(i18n);
@@ -473,6 +478,8 @@ function RiskImminentEventMap<
473478
{hazardTypeSelector(activeEvent) === 'TC' && (
474479
<LayerOptions
475480
value={layerOptions}
481+
// NOTE: Currently the information is only visible in gdacas
482+
exposureAreaControlHidden={source !== 'gdacs'}
476483
onChange={setLayerOptions}
477484
/>
478485
)}

app/src/components/domain/RiskImminentEvents/Gdacs/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ function Gdacs(props: Props) {
265265

266266
return (
267267
<RiskImminentEventMap
268+
source="gdacs"
268269
events={countryRiskResponse?.results}
269270
pointFeatureSelector={pointFeatureSelector}
270271
keySelector={numericIdSelector}

app/src/components/domain/RiskImminentEvents/MeteoSwiss/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ function MeteoSwiss(props: Props) {
209209

210210
return (
211211
<RiskImminentEventMap
212+
source="meteoSwiss"
212213
events={countryRiskResponse?.results}
213214
pointFeatureSelector={pointFeatureSelector}
214215
keySelector={numericIdSelector}

app/src/components/domain/RiskImminentEvents/Pdc/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ function Pdc(props: Props) {
246246

247247
return (
248248
<RiskImminentEventMap
249+
source="pdc"
249250
events={countryRiskResponse?.results}
250251
pointFeatureSelector={pointFeatureSelector}
251252
keySelector={numericIdSelector}

app/src/components/domain/RiskImminentEvents/WfpAdam/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ function WfpAdam(props: Props) {
216216

217217
return (
218218
<RiskImminentEventMap
219+
source="wfpAdam"
219220
events={countryRiskResponse?.results}
220221
pointFeatureSelector={pointFeatureSelector}
221222
keySelector={numericIdSelector}

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

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -195,33 +195,35 @@ function RiskImminentEvents(props: Props) {
195195
/>
196196
)}
197197
/>
198-
<Radio
199-
name="wfpAdam"
200-
value={activeView === 'wfpAdam'}
201-
onClick={handleRadioClick}
202-
label={strings.imminentEventsSourceWfpAdamLabel}
203-
actions={(
204-
<InfoPopup
205-
title={strings.wfpAdamTitle}
206-
popupClassName={styles.popup}
207-
descriptionClassName={styles.description}
208-
description={resolveToComponent(
209-
strings.wfpAdamDescription,
210-
{
211-
here: (
212-
<Link
213-
href="https://gis.wfp.org/adam/"
214-
variant="tertiary"
215-
external
216-
>
217-
{strings.here}
218-
</Link>
219-
),
220-
},
221-
)}
222-
/>
223-
)}
224-
/>
198+
{environment !== 'production' && (
199+
<Radio
200+
name="wfpAdam"
201+
value={activeView === 'wfpAdam'}
202+
onClick={handleRadioClick}
203+
label={strings.imminentEventsSourceWfpAdamLabel}
204+
actions={(
205+
<InfoPopup
206+
title={strings.wfpAdamTitle}
207+
popupClassName={styles.popup}
208+
descriptionClassName={styles.description}
209+
description={resolveToComponent(
210+
strings.wfpAdamDescription,
211+
{
212+
here: (
213+
<Link
214+
href="https://gis.wfp.org/adam/"
215+
variant="tertiary"
216+
external
217+
>
218+
{strings.here}
219+
</Link>
220+
),
221+
},
222+
)}
223+
/>
224+
)}
225+
/>
226+
)}
225227
<Radio
226228
name="gdacs"
227229
value={activeView === 'gdacs'}

0 commit comments

Comments
 (0)