From 72de98eee98f6f7366527403f4c09e7ed59e5e01 Mon Sep 17 00:00:00 2001 From: Chris Manciero Date: Sat, 23 Mar 2024 09:40:49 -0400 Subject: [PATCH 1/2] Fix hide of Click options layers --- .../analyze-areas-sidebar-card/component.jsx | 6 +++++- .../analyze-areas-sidebar-card/index.js | 8 +++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/containers/sidebars/data-global-sidebar/analyze-areas-sidebar-card/component.jsx b/src/containers/sidebars/data-global-sidebar/analyze-areas-sidebar-card/component.jsx index 2addb6059..bedc0629f 100644 --- a/src/containers/sidebars/data-global-sidebar/analyze-areas-sidebar-card/component.jsx +++ b/src/containers/sidebars/data-global-sidebar/analyze-areas-sidebar-card/component.jsx @@ -139,7 +139,11 @@ function AnalyzeAreasCardComponent({ id={option.slug} option={{ ...option, name: option.label }} checked={selectedOption?.slug === option.slug} - onChange={() => handleOptionSelection(option)} + onChange={() => { + if (selectedOption?.slug !== option.slug) { + handleOptionSelection(option); + } + }} theme={radioTheme} /> )} diff --git a/src/containers/sidebars/data-global-sidebar/analyze-areas-sidebar-card/index.js b/src/containers/sidebars/data-global-sidebar/analyze-areas-sidebar-card/index.js index 0cb574b8a..cd5f05beb 100644 --- a/src/containers/sidebars/data-global-sidebar/analyze-areas-sidebar-card/index.js +++ b/src/containers/sidebars/data-global-sidebar/analyze-areas-sidebar-card/index.js @@ -223,7 +223,8 @@ function AnalyzeAreasContainer(props) { layersToToggle.push({ layerId: formerSelectedSlug }); if ( newSelectedOption !== CLEAR_SELECTIONS && - formerSelectedSlug !== undefined + (formerSelectedSlug !== undefined || + formerSelectedSlug !== CLEAR_SELECTIONS) ) { layersToToggle.push({ layerId: newSelectedOption, @@ -254,6 +255,7 @@ function AnalyzeAreasContainer(props) { }; const layersToToggle = getLayersToToggle(); + const categories = layersToToggle.reduce((acc, layer) => { acc[layer.layerId] = layer.category; return acc; @@ -275,10 +277,6 @@ function AnalyzeAreasContainer(props) { setSketchWidgetMode('create'); // Maybe it was in edit mode handleSketchToolDestroy(); } - - if (selectedTab === 'click') { - handleLayerToggle(precalculatedAOIOptions[0]); - } }; const handleOptionSelection = (option) => { From cd5a39880f520f04179a170eccb5b328050a39a0 Mon Sep 17 00:00:00 2001 From: Chris Manciero Date: Mon, 25 Mar 2024 14:39:23 -0400 Subject: [PATCH 2/2] add graphic layer after clear selection option --- .../analyze-areas-sidebar-card/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/containers/sidebars/data-global-sidebar/analyze-areas-sidebar-card/index.js b/src/containers/sidebars/data-global-sidebar/analyze-areas-sidebar-card/index.js index cd5f05beb..d9892fed7 100644 --- a/src/containers/sidebars/data-global-sidebar/analyze-areas-sidebar-card/index.js +++ b/src/containers/sidebars/data-global-sidebar/analyze-areas-sidebar-card/index.js @@ -31,6 +31,7 @@ import { COMMUNITY_AREAS_VECTOR_TILE_LAYER, WDPA_OECM_FEATURE_LAYER, HALF_EARTH_FUTURE_TILE_LAYER, + GRAPHIC_LAYER, } from 'constants/layers-slugs'; import { LAYERS_CATEGORIES } from 'constants/mol-layers-configs'; @@ -236,6 +237,12 @@ function AnalyzeAreasContainer(props) { })); } + if (formerSelectedSlug === CLEAR_SELECTIONS) { + layersToToggle.push({ + layerId: GRAPHIC_LAYER, + }); + } + if (protectedAreasSelected) { const additionalProtectedAreasLayers = [ PROTECTED_AREAS_VECTOR_TILE_LAYER,