From a634ff56a5dbbcdb2280568a02c980e59f02bda4 Mon Sep 17 00:00:00 2001 From: mwbernard Date: Mon, 15 Jan 2024 16:34:11 -0800 Subject: [PATCH] Add crop group mobile control --- .../src/components/ExploreSidebar.vue | 7 +- vacs-map-app/src/components/MapTooltip.vue | 13 +-- .../components/MobileExploreMapControls.vue | 99 ++++++++++++++----- vacs-map-app/src/components/RadioSwitch.vue | 12 ++- .../src/components/TooltipWrapper.vue | 14 ++- 5 files changed, 102 insertions(+), 43 deletions(-) diff --git a/vacs-map-app/src/components/ExploreSidebar.vue b/vacs-map-app/src/components/ExploreSidebar.vue index 815ff25..e6546ce 100644 --- a/vacs-map-app/src/components/ExploreSidebar.vue +++ b/vacs-map-app/src/components/ExploreSidebar.vue @@ -71,7 +71,12 @@ alt="" @click="openScenarioModal(selectedModel)" /> - + diff --git a/vacs-map-app/src/components/MapTooltip.vue b/vacs-map-app/src/components/MapTooltip.vue index 40713a9..fe76a5c 100644 --- a/vacs-map-app/src/components/MapTooltip.vue +++ b/vacs-map-app/src/components/MapTooltip.vue @@ -5,7 +5,7 @@ v-if="showCropGroupMap" class="indicator" :style="{ - background: getColor(hoveredCropId) + background: colorStore?.getCropColor(hoveredCropId) }" /> @@ -43,7 +43,6 @@ const { hoveredId, showCropGroupMap, cropGroupMetric } = storeToRefs(mapExploreS const { data: yieldData } = storeToRefs(cropYieldsStore) const { selectedCrop, selectedModel } = storeToRefs(filtersStore) const { copy } = storeToRefs(contentStore) -const { ordinal: ordinalScheme, noData: noDataFill } = storeToRefs(colorStore) const { data: cropInfo } = storeToRefs(cropInformationStore) const sentence = computed(() => { @@ -83,16 +82,6 @@ const selectedCropInfo = computed(() => { return cropInfo.value?.find((d) => d.id === selectedCrop.value) }) -const cropGroupCrops = computed(() => { - const groupName = selectedCropInfo.value?.crop_group - return cropInfo.value?.filter((c) => c.crop_group === groupName) -}) - -const getColor = (crop) => { - if (crop === 'none') return noDataFill.value - return ordinalScheme.value[cropGroupCrops.value.map((d) => d.id).indexOf(crop)] -} - const hoveredCropId = computed(() => { if ( !yieldData.value || diff --git a/vacs-map-app/src/components/MobileExploreMapControls.vue b/vacs-map-app/src/components/MobileExploreMapControls.vue index eb893d7..cceb33a 100644 --- a/vacs-map-app/src/components/MobileExploreMapControls.vue +++ b/vacs-map-app/src/components/MobileExploreMapControls.vue @@ -1,37 +1,48 @@