From b751be7d2c0f3b9afe1f29643a1bfb036bf7e89e Mon Sep 17 00:00:00 2001 From: Brett Edwards Date: Wed, 27 Sep 2023 14:53:03 -0700 Subject: [PATCH 01/22] initial legend commit --- .../features/fba/components/map/FBAMap.tsx | 65 +++++++++++++++---- .../features/fba/components/map/Legend.tsx | 56 ++++++++++++++++ .../fba/components/map/featureStylers.ts | 21 +++--- .../fireWeather/components/maps/constants.ts | 4 +- 4 files changed, 123 insertions(+), 23 deletions(-) create mode 100644 web/src/features/fba/components/map/Legend.tsx diff --git a/web/src/features/fba/components/map/FBAMap.tsx b/web/src/features/fba/components/map/FBAMap.tsx index 276c8a1f2..c09dbbd14 100644 --- a/web/src/features/fba/components/map/FBAMap.tsx +++ b/web/src/features/fba/components/map/FBAMap.tsx @@ -27,12 +27,12 @@ import { } from 'features/fba/components/map/featureStylers' import { CENTER_OF_BC } from 'utils/constants' import { DateTime } from 'luxon' -import { LayerControl } from 'features/fba/components/map/layerControl' import { PMTILES_BUCKET, RASTER_SERVER_BASE_URL } from 'utils/env' import { RunType } from 'features/fba/pages/FireBehaviourAdvisoryPage' import { buildPMTilesURL } from 'features/fba/pmtilesBuilder' import { isUndefined, cloneDeep, isNull } from 'lodash' import { Box } from '@mui/material' +import Legend from 'features/fba/components/map/Legend' export const MapContext = React.createContext(null) @@ -82,7 +82,8 @@ const removeLayerByName = (map: ol.Map, layerName: string) => { const FBAMap = (props: FBAMapProps) => { const { stations } = useSelector(selectFireWeatherStations) - const [showHighHFI, setShowHighHFI] = useState(true) + const [showZoneStatus, setShowZoneStatus] = useState(true) + const [hfiChecked, setHFIChecked] = React.useState(false) const [map, setMap] = useState(null) const mapRef = useRef(null) const { mostRecentRunDate } = useSelector(selectRunDates) @@ -100,6 +101,27 @@ const FBAMap = (props: FBAMapProps) => { url: `${PMTILES_BUCKET}fireZoneLabels.pmtiles` }) + const handleToggleLayer = (layerName: string, isVisible: boolean) => { + if (map) { + const layer = map + .getLayers() + .getArray() + .find(l => l.getProperties()?.name === layerName) + + if (layerName === 'fireZoneVector') { + setShowZoneStatus(isVisible) + fireZoneVTL.setStyle( + fireZoneStyler(cloneDeep(props.fireZoneAreas), props.advisoryThreshold, props.selectedFireZone, isVisible) + ) + } else if (layer) { + layer.setVisible(isVisible) + if (layerName === 'hfiVector') { + setHFIChecked(isVisible) + } + } + } + } + const [fireCentreVTL] = useState( new VectorTileLayer({ source: fireCentreVectorSource, @@ -110,7 +132,12 @@ const FBAMap = (props: FBAMapProps) => { const [fireZoneVTL] = useState( new VectorTileLayer({ source: fireZoneVectorSource, - style: fireZoneStyler(cloneDeep(props.fireZoneAreas), props.advisoryThreshold, props.selectedFireZone), + style: fireZoneStyler( + cloneDeep(props.fireZoneAreas), + props.advisoryThreshold, + props.selectedFireZone, + showZoneStatus + ), zIndex: 49, properties: { name: 'fireZoneVector' } }) @@ -182,7 +209,7 @@ const FBAMap = (props: FBAMapProps) => { if (!map) return fireZoneVTL.setStyle( - fireZoneStyler(cloneDeep(props.fireZoneAreas), props.advisoryThreshold, props.selectedFireZone) + fireZoneStyler(cloneDeep(props.fireZoneAreas), props.advisoryThreshold, props.selectedFireZone, showZoneStatus) ) fireZoneLabelVTL.setStyle(fireZoneLabelStyler(props.selectedFireZone)) fireZoneVTL.changed() @@ -194,24 +221,25 @@ const FBAMap = (props: FBAMapProps) => { if (!map) return const layerName = 'hfiVector' removeLayerByName(map, layerName) - if (showHighHFI && !isNull(mostRecentRunDate)) { + if (!isNull(mostRecentRunDate)) { // The runDate for forecasts is the mostRecentRunDate. For Actuals, our API expects the runDate to be // the same as the forDate. const runDate = props.runType === RunType.FORECAST ? DateTime.fromISO(mostRecentRunDate) : props.forDate - const hfiGeojsonSource = new olpmtiles.PMTilesVectorSource({ + const hfiSource = new olpmtiles.PMTilesVectorSource({ url: buildPMTilesURL(props.forDate, props.runType, runDate) }) const latestHFILayer = new VectorTileLayer({ - source: hfiGeojsonSource, + source: hfiSource, style: hfiStyler, zIndex: 100, minZoom: 4, - properties: { name: layerName } + properties: { name: layerName }, + visible: hfiChecked }) map.addLayer(latestHFILayer) } - }, [showHighHFI, mostRecentRunDate]) // eslint-disable-line react-hooks/exhaustive-deps + }, [mostRecentRunDate]) // eslint-disable-line react-hooks/exhaustive-deps useEffect(() => { // The React ref is used to attach to the div rendered in our @@ -239,8 +267,8 @@ const FBAMap = (props: FBAMapProps) => { ], overlays: [], controls: defaultControls().extend([ - new FullScreen(), - LayerControl.buildLayerCheckbox('High HFI', setShowHighHFI, showHighHFI) + new FullScreen() + // LayerControl.buildLayerCheckbox('High HFI', setShowHighHFI, showHighHFI) ]) }) mapObject.setTarget(mapRef.current) @@ -277,7 +305,20 @@ const FBAMap = (props: FBAMapProps) => { return ( - + + + + + ) diff --git a/web/src/features/fba/components/map/Legend.tsx b/web/src/features/fba/components/map/Legend.tsx new file mode 100644 index 000000000..b1df11fcf --- /dev/null +++ b/web/src/features/fba/components/map/Legend.tsx @@ -0,0 +1,56 @@ +import React from 'react' +import { Grid, Typography, Checkbox } from '@mui/material' +import { styled } from '@mui/material/styles' + +interface LegendItemProps { + label: string + checked: boolean + onChange: (event: React.ChangeEvent, checked: boolean) => void +} + +const LegendItem: React.FC = ({ label, checked, onChange }) => ( + + + + + + {label} + + +) + +const LegendGrid = styled(Grid)({ + display: 'flex', + flexDirection: 'column', + width: 'fit-content', + backgroundColor: '#fffafa', + paddingRight: '1rem' +}) + +interface LegendProps { + onToggleLayer: (layerName: string, isVisible: boolean) => void +} + +const Legend = ({ onToggleLayer }: LegendProps) => { + const [fireZoneChecked, setFireZoneChecked] = React.useState(true) + const [hfiChecked, setHFIChecked] = React.useState(false) + + const handleLayer1Change = () => { + setFireZoneChecked(!fireZoneChecked) + onToggleLayer('fireZoneVector', !fireZoneChecked) + } + + const handleLayer2Change = () => { + setHFIChecked(!hfiChecked) + onToggleLayer('hfiVector', !hfiChecked) + } + + return ( + + + + + ) +} + +export default Legend diff --git a/web/src/features/fba/components/map/featureStylers.ts b/web/src/features/fba/components/map/featureStylers.ts index 630e73b87..1b87191cc 100644 --- a/web/src/features/fba/components/map/featureStylers.ts +++ b/web/src/features/fba/components/map/featureStylers.ts @@ -8,8 +8,11 @@ import { range, startCase, lowerCase, isUndefined } from 'lodash' import { FireZone, FireZoneArea } from 'api/fbaAPI' const EMPTY_FILL = 'rgba(0, 0, 0, 0.0)' -const ADVISORY_ORANGE_FILL = 'rgba(255, 147, 38, 0.4)' -const ADVISORY_RED_FILL = 'rgba(128, 0, 0, 0.4)' +export const ADVISORY_ORANGE_FILL = 'rgba(255, 147, 38, 0.4)' +export const ADVISORY_RED_FILL = 'rgba(128, 0, 0, 0.4)' + +export const HFI_ADVISORY = 'rgba(255, 128, 0, 0.4)' +export const HFI_WARNING = 'rgba(255, 0, 0, 0.4)' const fireCentreTextStyler = (feature: RenderFeature | ol.Feature): Text => { const text = feature.get('mof_fire_centre_name').replace(' Fire Centre', '\nFire Centre') @@ -40,13 +43,13 @@ export const fireCentreStyler = (): Style => { export const fireZoneStyler = ( fireZoneAreas: FireZoneArea[], advisoryThreshold: number, - selectedFireZone: FireZone | undefined + selectedFireZone: FireZone | undefined, + showZoneStatus: boolean ) => { const a = (feature: RenderFeature | ol.Feature): Style => { const mof_fire_zone_id = feature.get('MOF_FIRE_ZONE_ID') const fireZoneAreaByThreshold = fireZoneAreas.filter(f => f.mof_fire_zone_id === mof_fire_zone_id) - const selected = - selectedFireZone?.mof_fire_zone_id && selectedFireZone.mof_fire_zone_id === mof_fire_zone_id ? true : false + const selected = !!(selectedFireZone?.mof_fire_zone_id && selectedFireZone.mof_fire_zone_id === mof_fire_zone_id) let strokeValue = 'black' if (selected) { strokeValue = 'green' @@ -57,7 +60,7 @@ export const fireZoneStyler = ( color: strokeValue, width: selected ? 8 : 1 }), - fill: getAdvisoryColors(advisoryThreshold, fireZoneAreaByThreshold) + fill: showZoneStatus ? getAdvisoryColors(advisoryThreshold, fireZoneAreaByThreshold) : undefined }) } return a @@ -158,11 +161,11 @@ const hfiStyle = new Style({}) export const hfiStyler = (feature: RenderFeature | ol.Feature): Style => { const hfi = feature.get('hfi') if (hfi === 1) { - hfiStyle.setFill(new Fill({ color: 'rgba(255, 128, 0, 0.4)' })) + hfiStyle.setFill(new Fill({ color: HFI_ADVISORY })) } else if (hfi === 2) { - hfiStyle.setFill(new Fill({ color: 'rgba(255, 0, 0, 0.4)' })) + hfiStyle.setFill(new Fill({ color: HFI_WARNING })) } else { - hfiStyle.setFill(new Fill({ color: 'rgba(0, 0, 0, 0)' })) + hfiStyle.setFill(new Fill({ color: EMPTY_FILL })) } return hfiStyle } diff --git a/web/src/features/fireWeather/components/maps/constants.ts b/web/src/features/fireWeather/components/maps/constants.ts index 09207ac02..f216916a1 100644 --- a/web/src/features/fireWeather/components/maps/constants.ts +++ b/web/src/features/fireWeather/components/maps/constants.ts @@ -9,10 +9,10 @@ export const BC_ROAD_BASE_MAP_SERVER_URL = 'https://maps.gov.bc.ca/arcgis/rest/s // a new source is not allocated every time WeatherMap is re-rendered, // which causes the TileLayer to re-render. export const source = new XYZ({ - url: `${BC_ROAD_BASE_MAP_SERVER_URL}/tile/{z}/{y}/{x}`, + url: `${BC_ROAD_BASE_MAP_SERVER_URL}/tile/{z}/{y}/{x}` // Normally we would get attribution text from `${BC_ROAD_BASE_MAP_SERVER_URL}?f=pjson` // however this endpoint only allows the origin of http://localhost:3000, so the text has been just copied from that link - attributions: 'Government of British Columbia, DataBC, GeoBC' + // attributions: 'Government of British Columbia, DataBC, GeoBC' }) // This "monochrome" source doesn't have the level of detail that the roads layers does, From 59715ff193523de86ee6157ed691604825c65012 Mon Sep 17 00:00:00 2001 From: Brett Edwards Date: Thu, 28 Sep 2023 08:34:07 -0700 Subject: [PATCH 02/22] adds state mgmt and subItems --- .../features/fba/components/map/Legend.tsx | 63 ++++++++++++++----- 1 file changed, 46 insertions(+), 17 deletions(-) diff --git a/web/src/features/fba/components/map/Legend.tsx b/web/src/features/fba/components/map/Legend.tsx index b1df11fcf..23c1a1f5b 100644 --- a/web/src/features/fba/components/map/Legend.tsx +++ b/web/src/features/fba/components/map/Legend.tsx @@ -1,22 +1,37 @@ import React from 'react' -import { Grid, Typography, Checkbox } from '@mui/material' +import { Grid, Typography, Checkbox, List, ListItem, ListItemText } from '@mui/material' import { styled } from '@mui/material/styles' +interface SubItem { + label: string +} interface LegendItemProps { label: string checked: boolean onChange: (event: React.ChangeEvent, checked: boolean) => void + subItems?: SubItem[] } -const LegendItem: React.FC = ({ label, checked, onChange }) => ( - - - +const LegendItem: React.FC = ({ label, checked, onChange, subItems }) => ( +
+ + + + + + {label} + - - {label} - - + {subItems && ( + + {subItems.map(subItem => ( + + {subItem.label} + + ))} + + )} +
) const LegendGrid = styled(Grid)({ @@ -24,7 +39,8 @@ const LegendGrid = styled(Grid)({ flexDirection: 'column', width: 'fit-content', backgroundColor: '#fffafa', - paddingRight: '1rem' + paddingRight: '1rem', + marginLeft: '1rem' }) interface LegendProps { @@ -32,23 +48,36 @@ interface LegendProps { } const Legend = ({ onToggleLayer }: LegendProps) => { - const [fireZoneChecked, setFireZoneChecked] = React.useState(true) + const [zoneStatusChecked, setZoneStatusChecked] = React.useState(true) const [hfiChecked, setHFIChecked] = React.useState(false) - const handleLayer1Change = () => { - setFireZoneChecked(!fireZoneChecked) - onToggleLayer('fireZoneVector', !fireZoneChecked) + const handleFireZoneLayerChange = () => { + setZoneStatusChecked(!zoneStatusChecked) + onToggleLayer('fireZoneVector', !zoneStatusChecked) } - const handleLayer2Change = () => { + const handleHFILayerChange = () => { setHFIChecked(!hfiChecked) onToggleLayer('hfiVector', !hfiChecked) } + const zoneStatusSubItems: SubItem[] = [{ label: 'Advisory' }, { label: 'Warning' }] + const hfiSubItems: SubItem[] = [{ label: '4,000 to 9,999' }, { label: '≥10,000' }] + return ( - - + + ) } From 5d6ecd44168f75cd260bc721cb56c6924e687a6e Mon Sep 17 00:00:00 2001 From: Brett Edwards Date: Thu, 28 Sep 2023 09:45:07 -0700 Subject: [PATCH 03/22] adds symbols to legend --- .../features/fba/components/map/Legend.tsx | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/web/src/features/fba/components/map/Legend.tsx b/web/src/features/fba/components/map/Legend.tsx index 23c1a1f5b..7de3c9e8d 100644 --- a/web/src/features/fba/components/map/Legend.tsx +++ b/web/src/features/fba/components/map/Legend.tsx @@ -1,9 +1,16 @@ import React from 'react' -import { Grid, Typography, Checkbox, List, ListItem, ListItemText } from '@mui/material' +import { Grid, Typography, Checkbox, List, ListItem, ListItemText, ListItemIcon, Icon } from '@mui/material' import { styled } from '@mui/material/styles' +import { + ADVISORY_ORANGE_FILL, + ADVISORY_RED_FILL, + HFI_ADVISORY, + HFI_WARNING +} from 'features/fba/components/map/featureStylers' interface SubItem { label: string + symbol: string } interface LegendItemProps { label: string @@ -23,9 +30,12 @@ const LegendItem: React.FC = ({ label, checked, onChange, subIt
{subItems && ( - + {subItems.map(subItem => ( + + + {subItem.label} ))} @@ -61,8 +71,14 @@ const Legend = ({ onToggleLayer }: LegendProps) => { onToggleLayer('hfiVector', !hfiChecked) } - const zoneStatusSubItems: SubItem[] = [{ label: 'Advisory' }, { label: 'Warning' }] - const hfiSubItems: SubItem[] = [{ label: '4,000 to 9,999' }, { label: '≥10,000' }] + const zoneStatusSubItems: SubItem[] = [ + { label: 'Advisory', symbol: ADVISORY_ORANGE_FILL }, + { label: 'Warning', symbol: ADVISORY_RED_FILL } + ] + const hfiSubItems: SubItem[] = [ + { label: '4,000 to 9,999', symbol: HFI_ADVISORY }, + { label: '≥10,000', symbol: HFI_WARNING } + ] return ( From 24fb78332512970c5d5a349ba3b044a2efb8e3d5 Mon Sep 17 00:00:00 2001 From: Brett Edwards Date: Thu, 28 Sep 2023 10:08:10 -0700 Subject: [PATCH 04/22] adds legend title --- web/src/features/fba/components/map/Legend.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web/src/features/fba/components/map/Legend.tsx b/web/src/features/fba/components/map/Legend.tsx index 7de3c9e8d..ea9b609e8 100644 --- a/web/src/features/fba/components/map/Legend.tsx +++ b/web/src/features/fba/components/map/Legend.tsx @@ -49,8 +49,10 @@ const LegendGrid = styled(Grid)({ flexDirection: 'column', width: 'fit-content', backgroundColor: '#fffafa', - paddingRight: '1rem', - marginLeft: '1rem' + paddingRight: '0.5rem', + paddingLeft: '0.5rem', + marginLeft: '1rem', + border: '2px solid black' }) interface LegendProps { @@ -82,6 +84,9 @@ const Legend = ({ onToggleLayer }: LegendProps) => { return ( + + BC Fire Advisory Legend + Date: Thu, 28 Sep 2023 10:41:39 -0700 Subject: [PATCH 05/22] adjust alignment --- web/src/features/fba/components/map/FBAMap.tsx | 7 +++---- web/src/features/fba/components/map/Legend.tsx | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/web/src/features/fba/components/map/FBAMap.tsx b/web/src/features/fba/components/map/FBAMap.tsx index c09dbbd14..364d43134 100644 --- a/web/src/features/fba/components/map/FBAMap.tsx +++ b/web/src/features/fba/components/map/FBAMap.tsx @@ -309,13 +309,12 @@ const FBAMap = (props: FBAMapProps) => { ref={mapRef} data-testid="fba-map" sx={{ + display: 'flex', flex: 1, - flexDirection: 'column', - position: 'relative', - justifyContent: 'flex-end' + position: 'relative' }} > - + diff --git a/web/src/features/fba/components/map/Legend.tsx b/web/src/features/fba/components/map/Legend.tsx index ea9b609e8..80d1d0713 100644 --- a/web/src/features/fba/components/map/Legend.tsx +++ b/web/src/features/fba/components/map/Legend.tsx @@ -51,7 +51,7 @@ const LegendGrid = styled(Grid)({ backgroundColor: '#fffafa', paddingRight: '0.5rem', paddingLeft: '0.5rem', - marginLeft: '1rem', + marginLeft: '0.5rem', border: '2px solid black' }) @@ -84,7 +84,7 @@ const Legend = ({ onToggleLayer }: LegendProps) => { return ( - + BC Fire Advisory Legend Date: Thu, 28 Sep 2023 11:06:19 -0700 Subject: [PATCH 06/22] bold title --- .../features/fba/components/map/Legend.tsx | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/web/src/features/fba/components/map/Legend.tsx b/web/src/features/fba/components/map/Legend.tsx index 80d1d0713..862bf066e 100644 --- a/web/src/features/fba/components/map/Legend.tsx +++ b/web/src/features/fba/components/map/Legend.tsx @@ -8,6 +8,17 @@ import { HFI_WARNING } from 'features/fba/components/map/featureStylers' +const LegendGrid = styled(Grid)({ + display: 'flex', + flexDirection: 'column', + width: 'fit-content', + backgroundColor: '#fffafa', + paddingRight: '0.5rem', + paddingLeft: '0.5rem', + marginLeft: '0.5rem', + border: '2px solid black' +}) + interface SubItem { label: string symbol: string @@ -44,17 +55,6 @@ const LegendItem: React.FC = ({ label, checked, onChange, subIt ) -const LegendGrid = styled(Grid)({ - display: 'flex', - flexDirection: 'column', - width: 'fit-content', - backgroundColor: '#fffafa', - paddingRight: '0.5rem', - paddingLeft: '0.5rem', - marginLeft: '0.5rem', - border: '2px solid black' -}) - interface LegendProps { onToggleLayer: (layerName: string, isVisible: boolean) => void } @@ -84,7 +84,7 @@ const Legend = ({ onToggleLayer }: LegendProps) => { return ( - + BC Fire Advisory Legend Date: Thu, 28 Sep 2023 14:31:16 -0700 Subject: [PATCH 07/22] manage state better, FBAMap -> Legend --- .../features/fba/components/map/FBAMap.tsx | 21 +++++++++---------- .../features/fba/components/map/Legend.tsx | 21 ++++++++++--------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/web/src/features/fba/components/map/FBAMap.tsx b/web/src/features/fba/components/map/FBAMap.tsx index 364d43134..0ce343e34 100644 --- a/web/src/features/fba/components/map/FBAMap.tsx +++ b/web/src/features/fba/components/map/FBAMap.tsx @@ -83,7 +83,7 @@ const removeLayerByName = (map: ol.Map, layerName: string) => { const FBAMap = (props: FBAMapProps) => { const { stations } = useSelector(selectFireWeatherStations) const [showZoneStatus, setShowZoneStatus] = useState(true) - const [hfiChecked, setHFIChecked] = React.useState(false) + const [showHFI, setShowHFI] = React.useState(false) const [map, setMap] = useState(null) const mapRef = useRef(null) const { mostRecentRunDate } = useSelector(selectRunDates) @@ -109,15 +109,11 @@ const FBAMap = (props: FBAMapProps) => { .find(l => l.getProperties()?.name === layerName) if (layerName === 'fireZoneVector') { - setShowZoneStatus(isVisible) fireZoneVTL.setStyle( fireZoneStyler(cloneDeep(props.fireZoneAreas), props.advisoryThreshold, props.selectedFireZone, isVisible) ) } else if (layer) { layer.setVisible(isVisible) - if (layerName === 'hfiVector') { - setHFIChecked(isVisible) - } } } } @@ -235,7 +231,7 @@ const FBAMap = (props: FBAMapProps) => { zIndex: 100, minZoom: 4, properties: { name: layerName }, - visible: hfiChecked + visible: showHFI }) map.addLayer(latestHFILayer) } @@ -266,10 +262,7 @@ const FBAMap = (props: FBAMapProps) => { fireZoneLabelVTL ], overlays: [], - controls: defaultControls().extend([ - new FullScreen() - // LayerControl.buildLayerCheckbox('High HFI', setShowHighHFI, showHighHFI) - ]) + controls: defaultControls().extend([new FullScreen()]) }) mapObject.setTarget(mapRef.current) @@ -315,7 +308,13 @@ const FBAMap = (props: FBAMapProps) => { }} > - + diff --git a/web/src/features/fba/components/map/Legend.tsx b/web/src/features/fba/components/map/Legend.tsx index 862bf066e..c4b893323 100644 --- a/web/src/features/fba/components/map/Legend.tsx +++ b/web/src/features/fba/components/map/Legend.tsx @@ -57,20 +57,21 @@ const LegendItem: React.FC = ({ label, checked, onChange, subIt interface LegendProps { onToggleLayer: (layerName: string, isVisible: boolean) => void + showZoneStatus: boolean + setShowZoneStatus: React.Dispatch> + showHFI: boolean + setShowHFI: React.Dispatch> } -const Legend = ({ onToggleLayer }: LegendProps) => { - const [zoneStatusChecked, setZoneStatusChecked] = React.useState(true) - const [hfiChecked, setHFIChecked] = React.useState(false) - +const Legend = ({ onToggleLayer, showZoneStatus, setShowZoneStatus, showHFI, setShowHFI }: LegendProps) => { const handleFireZoneLayerChange = () => { - setZoneStatusChecked(!zoneStatusChecked) - onToggleLayer('fireZoneVector', !zoneStatusChecked) + setShowZoneStatus(!showZoneStatus) + onToggleLayer('fireZoneVector', !showZoneStatus) } const handleHFILayerChange = () => { - setHFIChecked(!hfiChecked) - onToggleLayer('hfiVector', !hfiChecked) + setShowHFI(!showHFI) + onToggleLayer('hfiVector', !showHFI) } const zoneStatusSubItems: SubItem[] = [ @@ -89,13 +90,13 @@ const Legend = ({ onToggleLayer }: LegendProps) => { From 633cfaef624f4b2080d63d7789394c0ff24866c6 Mon Sep 17 00:00:00 2001 From: Brett Edwards Date: Thu, 28 Sep 2023 15:33:21 -0700 Subject: [PATCH 08/22] css cleanup --- web/src/features/fba/components/map/Legend.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/src/features/fba/components/map/Legend.tsx b/web/src/features/fba/components/map/Legend.tsx index c4b893323..9f67057c0 100644 --- a/web/src/features/fba/components/map/Legend.tsx +++ b/web/src/features/fba/components/map/Legend.tsx @@ -19,6 +19,11 @@ const LegendGrid = styled(Grid)({ border: '2px solid black' }) +const LegendSymbol = styled(Icon)({ + width: '2.5rem', + height: '1rem' +}) + interface SubItem { label: string symbol: string @@ -45,7 +50,7 @@ const LegendItem: React.FC = ({ label, checked, onChange, subIt {subItems.map(subItem => ( - + {subItem.label} From 8a8288e32625b9ea550da8826c0269e8b74ae91a Mon Sep 17 00:00:00 2001 From: Brett Edwards Date: Thu, 28 Sep 2023 15:39:51 -0700 Subject: [PATCH 09/22] disable flaky morecast 1 test --- web/cypress/e2e/morecast-page.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/cypress/e2e/morecast-page.cy.ts b/web/cypress/e2e/morecast-page.cy.ts index 03301af5d..c097102c7 100644 --- a/web/cypress/e2e/morecast-page.cy.ts +++ b/web/cypress/e2e/morecast-page.cy.ts @@ -76,7 +76,7 @@ describe('MoreCast Page', () => { cy.contains('Data is not available.') }) - it('Should display a map with OpenLayers', () => { + xit('Should display a map with OpenLayers', () => { cy.visit(MORECAST_ROUTE) // Should be able to find its zoom control From 5ad05113d45419a939b8797c597da910cb233d43 Mon Sep 17 00:00:00 2001 From: Brett Edwards Date: Thu, 28 Sep 2023 15:49:28 -0700 Subject: [PATCH 10/22] bring back hfi dependency --- web/src/features/fba/components/map/FBAMap.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/features/fba/components/map/FBAMap.tsx b/web/src/features/fba/components/map/FBAMap.tsx index 0ce343e34..852aa0c3b 100644 --- a/web/src/features/fba/components/map/FBAMap.tsx +++ b/web/src/features/fba/components/map/FBAMap.tsx @@ -235,7 +235,7 @@ const FBAMap = (props: FBAMapProps) => { }) map.addLayer(latestHFILayer) } - }, [mostRecentRunDate]) // eslint-disable-line react-hooks/exhaustive-deps + }, [showHFI, mostRecentRunDate]) // eslint-disable-line react-hooks/exhaustive-deps useEffect(() => { // The React ref is used to attach to the div rendered in our From 0ab77411f2385cd6971da35e99653c864c186def Mon Sep 17 00:00:00 2001 From: Brett Edwards Date: Thu, 28 Sep 2023 16:05:55 -0700 Subject: [PATCH 11/22] dedupe some code --- .../features/fba/components/map/Legend.tsx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/web/src/features/fba/components/map/Legend.tsx b/web/src/features/fba/components/map/Legend.tsx index 9f67057c0..a0bb067b5 100644 --- a/web/src/features/fba/components/map/Legend.tsx +++ b/web/src/features/fba/components/map/Legend.tsx @@ -69,14 +69,13 @@ interface LegendProps { } const Legend = ({ onToggleLayer, showZoneStatus, setShowZoneStatus, showHFI, setShowHFI }: LegendProps) => { - const handleFireZoneLayerChange = () => { - setShowZoneStatus(!showZoneStatus) - onToggleLayer('fireZoneVector', !showZoneStatus) - } - - const handleHFILayerChange = () => { - setShowHFI(!showHFI) - onToggleLayer('hfiVector', !showHFI) + const handleLayerChange = ( + layerName: string, + isVisible: boolean, + setShowLayer: React.Dispatch> + ) => { + setShowLayer(!isVisible) + onToggleLayer(layerName, !isVisible) } const zoneStatusSubItems: SubItem[] = [ @@ -96,13 +95,13 @@ const Legend = ({ onToggleLayer, showZoneStatus, setShowZoneStatus, showHFI, set handleLayerChange('fireZoneVector', showZoneStatus, setShowZoneStatus)} subItems={zoneStatusSubItems} /> handleLayerChange('hfiVector', showHFI, setShowHFI)} subItems={hfiSubItems} /> From d0bacc8861d86d13ac5fe6de5639523346c3cf56 Mon Sep 17 00:00:00 2001 From: Brett Edwards Date: Thu, 28 Sep 2023 16:10:12 -0700 Subject: [PATCH 12/22] Remove unused hfi layer defs, replaced by pmtiles --- .../features/fba/components/map/FBAMap.tsx | 26 ++----------------- 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/web/src/features/fba/components/map/FBAMap.tsx b/web/src/features/fba/components/map/FBAMap.tsx index 852aa0c3b..997211981 100644 --- a/web/src/features/fba/components/map/FBAMap.tsx +++ b/web/src/features/fba/components/map/FBAMap.tsx @@ -6,14 +6,13 @@ import { defaults as defaultControls, FullScreen } from 'ol/control' import { fromLonLat } from 'ol/proj' import OLVectorLayer from 'ol/layer/Vector' import VectorTileLayer from 'ol/layer/VectorTile' -import XYZ from 'ol/source/XYZ' import VectorSource from 'ol/source/Vector' import GeoJSON from 'ol/format/GeoJSON' import { useSelector } from 'react-redux' import React, { useEffect, useRef, useState } from 'react' import { ErrorBoundary } from 'components' import { selectFireWeatherStations, selectRunDates } from 'app/rootReducer' -import { source as baseMapSource, COG_TILE_SIZE, SFMS_MAX_ZOOM } from 'features/fireWeather/components/maps/constants' +import { source as baseMapSource } from 'features/fireWeather/components/maps/constants' import Tile from 'ol/layer/Tile' import { FireCenter, FireZone, FireZoneArea } from 'api/fbaAPI' import { extentsMap } from 'features/fba/fireCentreExtents' @@ -27,7 +26,7 @@ import { } from 'features/fba/components/map/featureStylers' import { CENTER_OF_BC } from 'utils/constants' import { DateTime } from 'luxon' -import { PMTILES_BUCKET, RASTER_SERVER_BASE_URL } from 'utils/env' +import { PMTILES_BUCKET } from 'utils/env' import { RunType } from 'features/fba/pages/FireBehaviourAdvisoryPage' import { buildPMTilesURL } from 'features/fba/pmtilesBuilder' import { isUndefined, cloneDeep, isNull } from 'lodash' @@ -49,27 +48,6 @@ export interface FBAMapProps { advisoryThreshold: number } -export const hfiSourceFactory = (url: string) => { - return new XYZ({ - url: `${RASTER_SERVER_BASE_URL}/tile/{z}/{x}/{y}?path=${url}&source=hfi`, - interpolate: false, - tileSize: COG_TILE_SIZE, - maxZoom: SFMS_MAX_ZOOM - }) -} - -export const ftlSourceFactory = (filter: string) => { - return new XYZ({ - url: `${RASTER_SERVER_BASE_URL}/tile/{z}/{x}/{y}?path=gpdqha/ftl/ftl_2018_cloudoptimized.tif&source=ftl&filter=${filter}`, - interpolate: true, - tileSize: COG_TILE_SIZE - }) -} - -export const hfiTileFactory = (url: string, layerName: string) => { - return new Tile({ source: hfiSourceFactory(url), properties: { name: layerName } }) -} - const removeLayerByName = (map: ol.Map, layerName: string) => { const layer = map .getLayers() From c76bde9219ad5889debe68e622ab8786ea6221be Mon Sep 17 00:00:00 2001 From: Brett Edwards Date: Fri, 29 Sep 2023 09:44:27 -0700 Subject: [PATCH 13/22] fixes fire zone not selectable if not color filled --- web/src/features/fba/components/map/featureStylers.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/src/features/fba/components/map/featureStylers.ts b/web/src/features/fba/components/map/featureStylers.ts index 1b87191cc..2c244db6c 100644 --- a/web/src/features/fba/components/map/featureStylers.ts +++ b/web/src/features/fba/components/map/featureStylers.ts @@ -60,7 +60,9 @@ export const fireZoneStyler = ( color: strokeValue, width: selected ? 8 : 1 }), - fill: showZoneStatus ? getAdvisoryColors(advisoryThreshold, fireZoneAreaByThreshold) : undefined + fill: showZoneStatus + ? getAdvisoryColors(advisoryThreshold, fireZoneAreaByThreshold) + : new Fill({ color: EMPTY_FILL }) }) } return a From 6549c64f7dfbcadbf03943b901c68b4933dcf511 Mon Sep 17 00:00:00 2001 From: Brett Edwards Date: Fri, 29 Sep 2023 12:06:28 -0700 Subject: [PATCH 14/22] adds functioning summary panel close button --- .../fba/components/ZoneSummaryPanel.tsx | 18 ++++++++++++++++-- web/src/features/fba/components/map/FBAMap.tsx | 11 +++++++++++ .../fba/pages/FireBehaviourAdvisoryPage.tsx | 5 +++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/web/src/features/fba/components/ZoneSummaryPanel.tsx b/web/src/features/fba/components/ZoneSummaryPanel.tsx index bd696a62e..cf37e1ee3 100644 --- a/web/src/features/fba/components/ZoneSummaryPanel.tsx +++ b/web/src/features/fba/components/ZoneSummaryPanel.tsx @@ -1,11 +1,12 @@ import React from 'react' import { styled } from '@mui/material/styles' import CombustibleAreaViz from 'features/fba/components/viz/CombustibleAreaViz' -import { Grid, Typography } from '@mui/material' +import { Grid, IconButton, Typography } from '@mui/material' import { isUndefined } from 'lodash' import { ElevationInfoByThreshold, FireZone, FireZoneArea, FireZoneThresholdFuelTypeArea } from 'api/fbaAPI' import ElevationInfoViz from 'features/fba/components/viz/ElevationInfoViz' import FuelTypesBreakdown from 'features/fba/components/viz/FuelTypesBreakdown' +import CloseIcon from '@mui/icons-material/Close' const SidePanelGrid = styled(Grid)({ minWidth: 400, @@ -32,16 +33,29 @@ interface Props { fuelTypeInfo: Record hfiElevationInfo: ElevationInfoByThreshold[] fireZoneAreas: FireZoneArea[] + showSummaryPanel: boolean + setShowSummaryPanel: React.Dispatch> } const ZoneSummaryPanel = React.forwardRef((props: Props, ref: React.ForwardedRef) => { ZoneSummaryPanel.displayName = 'ZoneSummaryPanel' - if (isUndefined(props.selectedFireZone)) { + const handleClose = () => { + props.setShowSummaryPanel(false) + } + + if (isUndefined(props.selectedFireZone) || !props.showSummaryPanel) { return
} else { return ( + + + + + + + {props.selectedFireZone.mof_fire_zone_name} diff --git a/web/src/features/fba/components/map/FBAMap.tsx b/web/src/features/fba/components/map/FBAMap.tsx index 997211981..b8d74a6fd 100644 --- a/web/src/features/fba/components/map/FBAMap.tsx +++ b/web/src/features/fba/components/map/FBAMap.tsx @@ -46,6 +46,8 @@ export interface FBAMapProps { fireZoneAreas: FireZoneArea[] runType: RunType advisoryThreshold: number + showSummaryPanel: boolean + setShowSummaryPanel: React.Dispatch> } const removeLayerByName = (map: ol.Map, layerName: string) => { @@ -158,12 +160,21 @@ const FBAMap = (props: FBAMapProps) => { mof_fire_centre_name: feature.get('MOF_FIRE_CENTRE_NAME'), area_sqm: feature.get('FEATURE_AREA_SQM') } + props.setShowSummaryPanel(true) props.setSelectedFireZone(fireZone) }) }) } }, [map]) // eslint-disable-line react-hooks/exhaustive-deps + useEffect(() => { + if (!map) return + + if (!props.showSummaryPanel) { + props.setSelectedFireZone(undefined) + } + }, [props.showSummaryPanel]) // eslint-disable-line react-hooks/exhaustive-deps + useEffect(() => { if (!map) return diff --git a/web/src/features/fba/pages/FireBehaviourAdvisoryPage.tsx b/web/src/features/fba/pages/FireBehaviourAdvisoryPage.tsx index a1b3bb1d5..d699c05cb 100644 --- a/web/src/features/fba/pages/FireBehaviourAdvisoryPage.tsx +++ b/web/src/features/fba/pages/FireBehaviourAdvisoryPage.tsx @@ -60,6 +60,7 @@ const FireBehaviourAdvisoryPage: React.FunctionComponent = () => { : DateTime.now().setZone(`UTC${PST_UTC_OFFSET}`).plus({ days: 1 }) ) const [runType, setRunType] = useState(RunType.FORECAST) + const [showSummaryPanel, setShowSummaryPanel] = useState(true) const { mostRecentRunDate } = useSelector(selectRunDates) const { fireZoneAreas } = useSelector(selectFireZoneAreas) @@ -225,6 +226,8 @@ const FireBehaviourAdvisoryPage: React.FunctionComponent = () => { fuelTypeInfo={hfiThresholdsFuelTypes} hfiElevationInfo={fireZoneElevationInfo} fireZoneAreas={fireZoneAreas} + showSummaryPanel={showSummaryPanel} + setShowSummaryPanel={setShowSummaryPanel} /> @@ -236,6 +239,8 @@ const FireBehaviourAdvisoryPage: React.FunctionComponent = () => { advisoryThreshold={advisoryThreshold} setSelectedFireZone={setSelectedFireZone} fireZoneAreas={fireZoneAreas} + showSummaryPanel={showSummaryPanel} + setShowSummaryPanel={setShowSummaryPanel} /> From 807f1de7663f531aaeaecb89601d06f3da9e57bd Mon Sep 17 00:00:00 2001 From: Brett Edwards Date: Fri, 29 Sep 2023 12:35:08 -0700 Subject: [PATCH 15/22] add props to fbaMap.test --- web/src/features/fba/components/map/fbaMap.test.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/src/features/fba/components/map/fbaMap.test.tsx b/web/src/features/fba/components/map/fbaMap.test.tsx index d4a23383c..b4c52bbbe 100644 --- a/web/src/features/fba/components/map/fbaMap.test.tsx +++ b/web/src/features/fba/components/map/fbaMap.test.tsx @@ -32,6 +32,10 @@ describe('FBAMap', () => { setSelectedFireZone={function (): void { throw new Error('Function not implemented.') }} + showSummaryPanel={true} + setShowSummaryPanel={function (): void { + throw new Error('Function not implemented.') + }} /> ) From bed625556cdc68c55f72a2bbe4556c0469b8d1ef Mon Sep 17 00:00:00 2001 From: Brett Edwards Date: Fri, 29 Sep 2023 14:58:16 -0700 Subject: [PATCH 16/22] adds map panning changes on click --- web/src/features/fba/components/map/FBAMap.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/features/fba/components/map/FBAMap.tsx b/web/src/features/fba/components/map/FBAMap.tsx index b8d74a6fd..4ba49f9f5 100644 --- a/web/src/features/fba/components/map/FBAMap.tsx +++ b/web/src/features/fba/components/map/FBAMap.tsx @@ -152,7 +152,7 @@ const FBAMap = (props: FBAMapProps) => { } const zoneExtent = feature.getGeometry()?.getExtent() if (!isUndefined(zoneExtent)) { - map.getView().fit(zoneExtent) + map.getView().fit(zoneExtent, { duration: 400, padding: [50, 50, 50, 50], maxZoom: 7.4 }) } const fireZone: FireZone = { mof_fire_zone_id: feature.get('MOF_FIRE_ZONE_ID'), From a9da4302a920798d8719807dae7095fb182d81dd Mon Sep 17 00:00:00 2001 From: Brett Edwards Date: Tue, 3 Oct 2023 10:32:19 -0700 Subject: [PATCH 17/22] Makes scroll bar permanent It will always be there anyway and removes stutter on zone change click --- web/src/features/fba/components/ZoneSummaryPanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/features/fba/components/ZoneSummaryPanel.tsx b/web/src/features/fba/components/ZoneSummaryPanel.tsx index cf37e1ee3..f9918a079 100644 --- a/web/src/features/fba/components/ZoneSummaryPanel.tsx +++ b/web/src/features/fba/components/ZoneSummaryPanel.tsx @@ -10,7 +10,7 @@ import CloseIcon from '@mui/icons-material/Close' const SidePanelGrid = styled(Grid)({ minWidth: 400, - overflowY: 'auto', + overflowY: 'scroll', maxHeight: '100%', padding: 0 }) From d64c50ee1c895199e3f1c84b7ac628f1070337fb Mon Sep 17 00:00:00 2001 From: Brett Edwards Date: Tue, 3 Oct 2023 14:45:21 -0700 Subject: [PATCH 18/22] legend font/margin changes --- .../features/fba/components/map/Legend.tsx | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/web/src/features/fba/components/map/Legend.tsx b/web/src/features/fba/components/map/Legend.tsx index a0bb067b5..e2371891d 100644 --- a/web/src/features/fba/components/map/Legend.tsx +++ b/web/src/features/fba/components/map/Legend.tsx @@ -13,8 +13,6 @@ const LegendGrid = styled(Grid)({ flexDirection: 'column', width: 'fit-content', backgroundColor: '#fffafa', - paddingRight: '0.5rem', - paddingLeft: '0.5rem', marginLeft: '0.5rem', border: '2px solid black' }) @@ -24,6 +22,13 @@ const LegendSymbol = styled(Icon)({ height: '1rem' }) +const LegendTitle = styled(Typography)({ + fontVariant: 'h1', + fontSize: '1.2rem', + fontWeight: 'bold', + margin: '0.8rem 0.6rem' +}) + interface SubItem { label: string symbol: string @@ -37,16 +42,18 @@ interface LegendItemProps { const LegendItem: React.FC = ({ label, checked, onChange, subItems }) => (
- + - {label} + + {label} + {subItems && ( - + {subItems.map(subItem => ( @@ -89,9 +96,9 @@ const Legend = ({ onToggleLayer, showZoneStatus, setShowZoneStatus, showHFI, set return ( - + BC Fire Advisory Legend - + Date: Tue, 3 Oct 2023 14:49:45 -0700 Subject: [PATCH 19/22] legend item padding changes --- web/src/features/fba/components/map/Legend.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/features/fba/components/map/Legend.tsx b/web/src/features/fba/components/map/Legend.tsx index e2371891d..e5237b34e 100644 --- a/web/src/features/fba/components/map/Legend.tsx +++ b/web/src/features/fba/components/map/Legend.tsx @@ -42,7 +42,7 @@ interface LegendItemProps { const LegendItem: React.FC = ({ label, checked, onChange, subItems }) => (
- + @@ -53,7 +53,7 @@ const LegendItem: React.FC = ({ label, checked, onChange, subIt {subItems && ( - + {subItems.map(subItem => ( From d73b13b38bf8dc76e4c2eb6f368037cf115f05cb Mon Sep 17 00:00:00 2001 From: Brett Edwards Date: Tue, 3 Oct 2023 15:49:37 -0700 Subject: [PATCH 20/22] change legend title --- .../features/fba/components/map/Legend.tsx | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/web/src/features/fba/components/map/Legend.tsx b/web/src/features/fba/components/map/Legend.tsx index e5237b34e..0dbe00ebd 100644 --- a/web/src/features/fba/components/map/Legend.tsx +++ b/web/src/features/fba/components/map/Legend.tsx @@ -42,28 +42,30 @@ interface LegendItemProps { const LegendItem: React.FC = ({ label, checked, onChange, subItems }) => (
- - - - - - - {label} - + + + + + + + + {label} + + + {subItems && ( + + {subItems.map(subItem => ( + + + + + {subItem.label} + + ))} + + )} - {subItems && ( - - {subItems.map(subItem => ( - - - - - {subItem.label} - - ))} - - )}
) @@ -95,9 +97,9 @@ const Legend = ({ onToggleLayer, showZoneStatus, setShowZoneStatus, showHFI, set ] return ( - + - BC Fire Advisory Legend + BC Fire Advisories Date: Wed, 4 Oct 2023 11:47:00 -0700 Subject: [PATCH 21/22] adds legend tests --- .../features/fba/components/map/Legend.tsx | 4 +-- .../fba/components/map/legend.test.tsx | 30 +++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 web/src/features/fba/components/map/legend.test.tsx diff --git a/web/src/features/fba/components/map/Legend.tsx b/web/src/features/fba/components/map/Legend.tsx index 0dbe00ebd..05ba22921 100644 --- a/web/src/features/fba/components/map/Legend.tsx +++ b/web/src/features/fba/components/map/Legend.tsx @@ -45,7 +45,7 @@ const LegendItem: React.FC = ({ label, checked, onChange, subIt - + @@ -97,7 +97,7 @@ const Legend = ({ onToggleLayer, showZoneStatus, setShowZoneStatus, showHFI, set ] return ( - + BC Fire Advisories diff --git a/web/src/features/fba/components/map/legend.test.tsx b/web/src/features/fba/components/map/legend.test.tsx new file mode 100644 index 000000000..ad0b972ec --- /dev/null +++ b/web/src/features/fba/components/map/legend.test.tsx @@ -0,0 +1,30 @@ +import Legend from 'features/fba/components/map/Legend' +import { render, waitFor, within } from '@testing-library/react' +import React from 'react' + +describe('Legend', () => { + it('should render with the default layer visibility', async () => { + const onToggleLayer = jest.fn() + const setShowZoneStatus = jest.fn() + const setShowHFI = jest.fn() + const { getByTestId } = render( + + ) + const legendComponent = getByTestId('asa-map-legend') + await waitFor(() => expect(legendComponent).toBeInTheDocument()) + + const zoneStatus = getByTestId('Zone Status-checkbox') + const zoneStatusCheckbox = within(zoneStatus).getByRole('checkbox') + await waitFor(() => expect(zoneStatusCheckbox).toBeChecked()) + + const hfi = getByTestId('HFI Potential (kW/h)-checkbox') + const hfiCheckbox = within(hfi).getByRole('checkbox') + await waitFor(() => expect(hfiCheckbox).not.toBeChecked()) + }) +}) From f3ba526dd61357cff75bd028c743ba11ddf01fd9 Mon Sep 17 00:00:00 2001 From: Brett Edwards Date: Wed, 4 Oct 2023 15:34:12 -0700 Subject: [PATCH 22/22] better testid names --- web/src/features/fba/components/map/Legend.tsx | 6 +++++- web/src/features/fba/components/map/legend.test.tsx | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/web/src/features/fba/components/map/Legend.tsx b/web/src/features/fba/components/map/Legend.tsx index 05ba22921..486fb551e 100644 --- a/web/src/features/fba/components/map/Legend.tsx +++ b/web/src/features/fba/components/map/Legend.tsx @@ -45,7 +45,11 @@ const LegendItem: React.FC = ({ label, checked, onChange, subIt - + diff --git a/web/src/features/fba/components/map/legend.test.tsx b/web/src/features/fba/components/map/legend.test.tsx index ad0b972ec..400d60f0d 100644 --- a/web/src/features/fba/components/map/legend.test.tsx +++ b/web/src/features/fba/components/map/legend.test.tsx @@ -19,11 +19,11 @@ describe('Legend', () => { const legendComponent = getByTestId('asa-map-legend') await waitFor(() => expect(legendComponent).toBeInTheDocument()) - const zoneStatus = getByTestId('Zone Status-checkbox') + const zoneStatus = getByTestId('zone-checkbox') const zoneStatusCheckbox = within(zoneStatus).getByRole('checkbox') await waitFor(() => expect(zoneStatusCheckbox).toBeChecked()) - const hfi = getByTestId('HFI Potential (kW/h)-checkbox') + const hfi = getByTestId('hfi-checkbox') const hfiCheckbox = within(hfi).getByRole('checkbox') await waitFor(() => expect(hfiCheckbox).not.toBeChecked()) })