From 86eb45477a0447dd19088fd83fd4349791b90cae Mon Sep 17 00:00:00 2001 From: Mike Simpson Date: Wed, 16 Aug 2023 14:15:18 +0100 Subject: [PATCH 1/2] Fix for Historical Map Button logic Remember to correctly turn both layers off when switching back to Age data --- .../building/data-containers/age-history.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/frontend/building/data-containers/age-history.tsx b/app/src/frontend/building/data-containers/age-history.tsx index 8100cbd2..00caa7c7 100644 --- a/app/src/frontend/building/data-containers/age-history.tsx +++ b/app/src/frontend/building/data-containers/age-history.tsx @@ -65,12 +65,14 @@ const AgeView: React.FunctionComponent = (props) => { const switchToAgeMapStyle = (e) => { e.preventDefault(); - if (props.mapColourScale == "survival_status") - { + if (historicData === 'enabled') { historicDataSwitchOnClick(e); } + if (historicMap === 'enabled') { + historicMapSwitchOnClick(e); + } - props.onMapColourScale('date_year') + props.onMapColourScale('date_year'); } const switchToStylePeriodMapStyle = (e) => { @@ -498,7 +500,7 @@ const AgeView: React.FunctionComponent = (props) => { Choose a colour to indicate whether the building has survived. - {(historicMap == "enabled") ? + {(historicMap === "enabled") ? @@ -507,7 +509,7 @@ const AgeView: React.FunctionComponent = (props) => { Click here to show the 1890s OS historical map. } - {(historicData == "enabled") ? + {(historicData === "enabled") ? From 2ed41b1f9d5f5f4f24c70db80c5d34c42cf01d66 Mon Sep 17 00:00:00 2001 From: Mike Simpson Date: Wed, 16 Aug 2023 14:49:30 +0100 Subject: [PATCH 2/2] Fix for switching layers via Layer Options menu --- app/src/frontend/displayPreferences-context.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/frontend/displayPreferences-context.tsx b/app/src/frontend/displayPreferences-context.tsx index a5b0094e..3bfcc1c3 100644 --- a/app/src/frontend/displayPreferences-context.tsx +++ b/app/src/frontend/displayPreferences-context.tsx @@ -297,7 +297,7 @@ export const DisplayPreferencesProvider: React.FC<{}> = ({children}) => { } flipHistoricData(e); }, - [historicData], + [historicData, historicMap], ) const historicDataSwitchOnClick = (e) => { flipHistoricData(e) @@ -315,7 +315,7 @@ export const DisplayPreferencesProvider: React.FC<{}> = ({children}) => { } fliphistoricMap(e); }, - [historicMap], + [historicMap, historicData], ) const historicMapSwitchOnClick = (e) => { fliphistoricMap(e)