From 76fa863bbe8c99b6e2bf0e72e485e45b0035c341 Mon Sep 17 00:00:00 2001 From: mwbernard Date: Tue, 28 Nov 2023 23:27:53 -0800 Subject: [PATCH 1/6] Add mobile for first two pages --- vacs-map-app/src/LandingPage.vue | 2 + vacs-map-app/src/assets/base.css | 1 + vacs-map-app/src/assets/img/show-filters.svg | 6 ++ vacs-map-app/src/assets/main.css | 6 ++ vacs-map-app/src/components/ContentModal.vue | 9 +++ vacs-map-app/src/components/CropFilters.vue | 76 ++++++++++++++++++- vacs-map-app/src/components/OverviewTop.vue | 9 ++- vacs-map-app/src/components/RadioList.vue | 1 - vacs-map-app/src/components/RadioSwitch.vue | 6 ++ .../src/components/pages/CropTypeOverview.vue | 44 ++++++++++- 10 files changed, 156 insertions(+), 4 deletions(-) create mode 100644 vacs-map-app/src/assets/img/show-filters.svg diff --git a/vacs-map-app/src/LandingPage.vue b/vacs-map-app/src/LandingPage.vue index e0673e0..5772246 100644 --- a/vacs-map-app/src/LandingPage.vue +++ b/vacs-map-app/src/LandingPage.vue @@ -185,6 +185,8 @@ button:hover { .callout { padding: 1rem; + max-width: 90%; + width: 95%; } .callout-header { diff --git a/vacs-map-app/src/assets/base.css b/vacs-map-app/src/assets/base.css index 1703cff..dc5635e 100644 --- a/vacs-map-app/src/assets/base.css +++ b/vacs-map-app/src/assets/base.css @@ -4,6 +4,7 @@ --black: #17191b; --black-90: rgba(25, 27, 30, 0.9); --black-80: rgba(25, 27, 30, 0.8); + --black-70: rgba(25, 27, 30, 0.7); --white: #e1dcd5; --white-hover: #a8a39c; --white-80: rgba(225, 220, 213, 0.8); diff --git a/vacs-map-app/src/assets/img/show-filters.svg b/vacs-map-app/src/assets/img/show-filters.svg new file mode 100644 index 0000000..a1eee08 --- /dev/null +++ b/vacs-map-app/src/assets/img/show-filters.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/vacs-map-app/src/assets/main.css b/vacs-map-app/src/assets/main.css index a0e6670..ffbd12b 100644 --- a/vacs-map-app/src/assets/main.css +++ b/vacs-map-app/src/assets/main.css @@ -11,3 +11,9 @@ --page-horizontal-margin: 3.5rem; } + +@media only screen and (max-width: 720px) { + #app{ + --page-horizontal-margin: 1rem; + } +} diff --git a/vacs-map-app/src/components/ContentModal.vue b/vacs-map-app/src/components/ContentModal.vue index d4f17ec..2545a74 100644 --- a/vacs-map-app/src/components/ContentModal.vue +++ b/vacs-map-app/src/components/ContentModal.vue @@ -61,6 +61,7 @@ onClickOutside(contentInnerRef, () => emit('close')) border-radius: 4px; overflow-y: auto; max-width: 50%; + max-height: 70%; padding: 2.5rem; } @@ -76,4 +77,12 @@ onClickOutside(contentInnerRef, () => emit('close')) cursor: pointer; height: 20px; } + + +@media only screen and (max-width: 720px) { + .content-modal-inner { + max-width: 95%; + } +} + diff --git a/vacs-map-app/src/components/CropFilters.vue b/vacs-map-app/src/components/CropFilters.vue index eff2624..733aa63 100644 --- a/vacs-map-app/src/components/CropFilters.vue +++ b/vacs-map-app/src/components/CropFilters.vue @@ -1,8 +1,15 @@ From 549647e508ba072c439ab5e4fcdc764eff9249dc Mon Sep 17 00:00:00 2001 From: mwbernard Date: Wed, 29 Nov 2023 00:03:53 -0800 Subject: [PATCH 2/6] Add mobile for explorer page --- vacs-map-app/src/MapExplorer.vue | 17 ++- .../components/MobileExploreMapControls.vue | 115 ++++++++++++++++++ vacs-map-app/src/components/RadioSwitch.vue | 1 + 3 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 vacs-map-app/src/components/MobileExploreMapControls.vue diff --git a/vacs-map-app/src/MapExplorer.vue b/vacs-map-app/src/MapExplorer.vue index 880d0cc..260c0b3 100644 --- a/vacs-map-app/src/MapExplorer.vue +++ b/vacs-map-app/src/MapExplorer.vue @@ -7,7 +7,7 @@ -
+
@@ -18,6 +18,7 @@ Add layer
+ @@ -41,6 +42,7 @@ import { useMapExploreStore } from '@/stores/mapExplore' import LayoutOverview from './components/layouts/LayoutOverview.vue' import ExploreSidebar from './components/ExploreSidebar.vue' import RegionPicker from './components/RegionPicker.vue' +import MobileExploreMapControls from './components/MobileExploreMapControls.vue' const availableMaps = [ // { @@ -210,6 +212,12 @@ select:hover { select:hover + .layer-selector-message { opacity: 1; } + +@media only screen and (max-width: 720px) { + .desktop { + display: none; + } +} diff --git a/vacs-map-app/src/components/MobileExploreMapControls.vue b/vacs-map-app/src/components/MobileExploreMapControls.vue new file mode 100644 index 0000000..a126ae4 --- /dev/null +++ b/vacs-map-app/src/components/MobileExploreMapControls.vue @@ -0,0 +1,115 @@ + + + + + \ No newline at end of file diff --git a/vacs-map-app/src/components/RadioSwitch.vue b/vacs-map-app/src/components/RadioSwitch.vue index 51bc038..7c0d4d8 100644 --- a/vacs-map-app/src/components/RadioSwitch.vue +++ b/vacs-map-app/src/components/RadioSwitch.vue @@ -50,6 +50,7 @@ const { name, options, modelValue } = toRefs(props) justify-content: space-between; border: 1px solid var(--gray); border-radius: 100px; + background: var(--dark-gray); } label { From b9513c41c74e5b80e1c616bd59b5abfacfc1c9ac Mon Sep 17 00:00:00 2001 From: mwbernard Date: Wed, 29 Nov 2023 00:12:52 -0800 Subject: [PATCH 3/6] Update back button for mobile --- vacs-map-app/src/assets/img/back-arrow.svg | 3 +++ .../src/components/NavigationButton.vue | 9 ++++++++- vacs-map-app/src/components/OverviewTop.vue | 17 ++++++++++++++++- 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 vacs-map-app/src/assets/img/back-arrow.svg diff --git a/vacs-map-app/src/assets/img/back-arrow.svg b/vacs-map-app/src/assets/img/back-arrow.svg new file mode 100644 index 0000000..3e735da --- /dev/null +++ b/vacs-map-app/src/assets/img/back-arrow.svg @@ -0,0 +1,3 @@ + + + diff --git a/vacs-map-app/src/components/NavigationButton.vue b/vacs-map-app/src/components/NavigationButton.vue index 5e6b7fb..0080426 100644 --- a/vacs-map-app/src/components/NavigationButton.vue +++ b/vacs-map-app/src/components/NavigationButton.vue @@ -19,7 +19,7 @@ const props = defineProps({ color: var(--white); background: var(--dark-gray); font-size: 1rem; - padding: 0.5rem; + padding: 0.625rem 0.75rem; text-decoration: none; display: flex; } @@ -27,4 +27,11 @@ const props = defineProps({ .navigation-button:hover { background: var(--dark-gray-hover); } + +@media only screen and (max-width: 720px) { + .navigation-button { + background: var(--ui-blue); + aspect-ratio: 1/1; + } +} diff --git a/vacs-map-app/src/components/OverviewTop.vue b/vacs-map-app/src/components/OverviewTop.vue index 88de311..8f0f9f1 100644 --- a/vacs-map-app/src/components/OverviewTop.vue +++ b/vacs-map-app/src/components/OverviewTop.vue @@ -6,7 +6,10 @@ - Back + Back + + + @@ -76,8 +79,20 @@ button:hover { background: var(--dark-gray-hover); } +.mobile { + display: none; +} + @media only screen and (max-width: 720px) { + + .desktop { + display: none; + } + + .mobile { + display: flex; + } .overview-top { font-size: 1rem; } From 46d9dbd4e146568603c6d86d48ccbe81934c8f5b Mon Sep 17 00:00:00 2001 From: mwbernard Date: Wed, 29 Nov 2023 00:13:15 -0800 Subject: [PATCH 4/6] Prettier --- vacs-map-app/src/LandingPage.vue | 2 +- vacs-map-app/src/MapExplorer.vue | 1 - vacs-map-app/src/assets/main.css | 2 +- vacs-map-app/src/components/ContentModal.vue | 4 +- vacs-map-app/src/components/CropFilters.vue | 6 +- .../src/components/DistributionPlot.vue | 2 +- vacs-map-app/src/components/GridOverlay.vue | 72 ++++++++----------- .../components/MobileExploreMapControls.vue | 21 ++---- .../src/components/NavigationButton.vue | 2 +- vacs-map-app/src/components/OverviewTop.vue | 4 +- vacs-map-app/src/components/RadioSwitch.vue | 2 +- .../src/components/pages/CropTypeOverview.vue | 22 +++--- vacs-map-app/src/stores/mapExplore.js | 2 +- 13 files changed, 56 insertions(+), 86 deletions(-) diff --git a/vacs-map-app/src/LandingPage.vue b/vacs-map-app/src/LandingPage.vue index 5772246..628ca57 100644 --- a/vacs-map-app/src/LandingPage.vue +++ b/vacs-map-app/src/LandingPage.vue @@ -2,7 +2,7 @@
diff --git a/vacs-map-app/src/MapExplorer.vue b/vacs-map-app/src/MapExplorer.vue index 260c0b3..f423dec 100644 --- a/vacs-map-app/src/MapExplorer.vue +++ b/vacs-map-app/src/MapExplorer.vue @@ -231,7 +231,6 @@ select:hover + .layer-selector-message { padding: 1.5rem; } - @media only screen and (max-width: 720px) { .region-picker { display: none; diff --git a/vacs-map-app/src/assets/main.css b/vacs-map-app/src/assets/main.css index ffbd12b..e70fd4d 100644 --- a/vacs-map-app/src/assets/main.css +++ b/vacs-map-app/src/assets/main.css @@ -13,7 +13,7 @@ } @media only screen and (max-width: 720px) { - #app{ + #app { --page-horizontal-margin: 1rem; } } diff --git a/vacs-map-app/src/components/ContentModal.vue b/vacs-map-app/src/components/ContentModal.vue index 2545a74..2edf24d 100644 --- a/vacs-map-app/src/components/ContentModal.vue +++ b/vacs-map-app/src/components/ContentModal.vue @@ -78,11 +78,9 @@ onClickOutside(contentInnerRef, () => emit('close')) height: 20px; } - @media only screen and (max-width: 720px) { .content-modal-inner { max-width: 95%; - } + } } - diff --git a/vacs-map-app/src/components/CropFilters.vue b/vacs-map-app/src/components/CropFilters.vue index 733aa63..5195b20 100644 --- a/vacs-map-app/src/components/CropFilters.vue +++ b/vacs-map-app/src/components/CropFilters.vue @@ -2,9 +2,9 @@
Filter crops - +
- +
climate scenario @@ -173,8 +173,6 @@ const scenarioOptions = computed(() => { display: none; } - - @media only screen and (max-width: 720px) { .mobile { display: flex; diff --git a/vacs-map-app/src/components/DistributionPlot.vue b/vacs-map-app/src/components/DistributionPlot.vue index 651c044..466c25f 100644 --- a/vacs-map-app/src/components/DistributionPlot.vue +++ b/vacs-map-app/src/components/DistributionPlot.vue @@ -156,7 +156,7 @@ const draw = () => { //draw hovered if (hoveredId.value) { - const cell = gridCells?.value.find(d => d.id === hoveredId.value); + const cell = gridCells?.value.find((d) => d.id === hoveredId.value) context.value.fillStyle = 'white' context.value.fillRect(cell.x, 0, 3, height.value) } diff --git a/vacs-map-app/src/components/GridOverlay.vue b/vacs-map-app/src/components/GridOverlay.vue index ad34278..cb0e072 100644 --- a/vacs-map-app/src/components/GridOverlay.vue +++ b/vacs-map-app/src/components/GridOverlay.vue @@ -4,8 +4,8 @@ import * as d3 from 'd3' import { computed, toRefs, watch } from 'vue' import { divergingScheme } from '@/utils/colors' -import { storeToRefs } from 'pinia'; -import { useMapExploreStore } from '../stores/mapExplore'; +import { storeToRefs } from 'pinia' +import { useMapExploreStore } from '../stores/mapExplore' const props = defineProps({ id: { @@ -84,8 +84,8 @@ const { stroke } = toRefs(props) -const mapExploreStore = useMapExploreStore(); -const { hoveredId } = storeToRefs(mapExploreStore); +const mapExploreStore = useMapExploreStore() +const { hoveredId } = storeToRefs(mapExploreStore) const addLayer = () => { if (!map.value || !mapReady.value || map.value.getLayer(id.value)) return @@ -99,19 +99,9 @@ const addLayer = () => { 'circle-stroke-width': fill.value ? 0.2 : 1.5, 'circle-stroke-color': getCircleStrokeColor(), 'circle-stroke-opacity': fill.value ? 0 : 0.8, - 'circle-opacity': [ - 'case', - ['boolean', ['feature-state', 'hovered'], false], - 0.5, - 1 - ], + 'circle-opacity': ['case', ['boolean', ['feature-state', 'hovered'], false], 0.5, 1], 'circle-color': getCircleFillColor(), - 'circle-blur': [ - 'case', - ['boolean', ['feature-state', 'hovered'], false], - 0, - 0.5 - ], + 'circle-blur': ['case', ['boolean', ['feature-state', 'hovered'], false], 0, 0.5] } }, 'settlement-subdivision-label' @@ -122,23 +112,23 @@ const addLayer = () => { const addHoverListeners = () => { if (!map.value || !mapReady.value || !map.value.getLayer(id.value)) return - + map.value.on('mousemove', id.value, (event) => { - if (!event?.features?.length) return; - const feature = event?.features[0]; + if (!event?.features?.length) return + const feature = event?.features[0] if (feature?.id) { - if (!feature.properties[colorColumn.value]) return; - hoveredId.value = feature.properties.id; + if (!feature.properties[colorColumn.value]) return + hoveredId.value = feature.properties.id } - }); + }) map.value.on('mouseleave', id.value, (event) => { - hoveredId.value = null; - }); + hoveredId.value = null + }) } const updateHoveredFeatureState = (elementId, hovered) => { - if (!id) return; + if (!id) return map.value.setFeatureState( { source: sourceId.value, @@ -147,7 +137,7 @@ const updateHoveredFeatureState = (elementId, hovered) => { { hovered } - ); + ) } const getCircleColorQuintiles = (quintiles) => { @@ -266,22 +256,22 @@ const getCircleColorDiverging = (extent, center) => { return [ 'case', ['!=', ['get', colorColumn.value], null], + [ + 'case', + ['boolean', ['feature-state', 'hovered'], false], + 'white', [ - 'case', - ['boolean', ['feature-state', 'hovered'], false], - 'white', - [ - 'interpolate', - ['linear'], - ['get', colorColumn.value], - min, - getColor(0), - center, - divergingScheme.center, - max, - getColor(1) - ], - ], + 'interpolate', + ['linear'], + ['get', colorColumn.value], + min, + getColor(0), + center, + divergingScheme.center, + max, + getColor(1) + ] + ], 'transparent' ] } diff --git a/vacs-map-app/src/components/MobileExploreMapControls.vue b/vacs-map-app/src/components/MobileExploreMapControls.vue index a126ae4..60f7ae5 100644 --- a/vacs-map-app/src/components/MobileExploreMapControls.vue +++ b/vacs-map-app/src/components/MobileExploreMapControls.vue @@ -11,10 +11,10 @@
- +
Emissions - +
@@ -24,19 +24,15 @@ \ No newline at end of file + diff --git a/vacs-map-app/src/components/NavigationButton.vue b/vacs-map-app/src/components/NavigationButton.vue index 0080426..40cbbb9 100644 --- a/vacs-map-app/src/components/NavigationButton.vue +++ b/vacs-map-app/src/components/NavigationButton.vue @@ -32,6 +32,6 @@ const props = defineProps({ .navigation-button { background: var(--ui-blue); aspect-ratio: 1/1; - } + } } diff --git a/vacs-map-app/src/components/OverviewTop.vue b/vacs-map-app/src/components/OverviewTop.vue index 8f0f9f1..5be1c4b 100644 --- a/vacs-map-app/src/components/OverviewTop.vue +++ b/vacs-map-app/src/components/OverviewTop.vue @@ -8,7 +8,7 @@ Back - + @@ -83,9 +83,7 @@ button:hover { display: none; } - @media only screen and (max-width: 720px) { - .desktop { display: none; } diff --git a/vacs-map-app/src/components/RadioSwitch.vue b/vacs-map-app/src/components/RadioSwitch.vue index 7c0d4d8..01799ff 100644 --- a/vacs-map-app/src/components/RadioSwitch.vue +++ b/vacs-map-app/src/components/RadioSwitch.vue @@ -90,6 +90,6 @@ input { @media only screen and (max-width: 720px) { .switch { width: 100%; - } + } } diff --git a/vacs-map-app/src/components/pages/CropTypeOverview.vue b/vacs-map-app/src/components/pages/CropTypeOverview.vue index 194d1b7..eab9bf2 100644 --- a/vacs-map-app/src/components/pages/CropTypeOverview.vue +++ b/vacs-map-app/src/components/pages/CropTypeOverview.vue @@ -1,29 +1,24 @@