From 806646ec06950c6332c3d991e846e7d5b7f818fd Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Thu, 29 Aug 2024 03:53:54 +0200 Subject: [PATCH] More styling of the new menu UX --- public/css/index-tailwind-output.css | 51 ++- src/Logic/Web/ThemeViewStateHashActor.ts | 39 +- src/UI/Base/DrawerLeft.svelte | 12 +- src/UI/Base/Link.svelte | 2 +- src/UI/Base/LogoutButton.svelte | 5 +- src/UI/Base/Page.svelte | 14 +- src/UI/BigComponents/FilterPage.svelte | 6 +- src/UI/BigComponents/MenuDrawer.svelte | 455 +++++++++++++---------- src/UI/Map/RasterLayerOverview.svelte | 7 +- src/UI/ThemeViewGUI.svelte | 4 +- src/index.css | 4 + 11 files changed, 353 insertions(+), 246 deletions(-) diff --git a/public/css/index-tailwind-output.css b/public/css/index-tailwind-output.css index 89a5008ca..94b9781aa 100644 --- a/public/css/index-tailwind-output.css +++ b/public/css/index-tailwind-output.css @@ -1041,8 +1041,8 @@ video { margin-bottom: 0.5rem; } -.mr-10 { - margin-right: 2.5rem; +.mr-16 { + margin-right: 4rem; } .mb-1\.5 { @@ -1280,6 +1280,10 @@ video { height: 1.25rem; } +.h-14 { + height: 3.5rem; +} + .h-16 { height: 4rem; } @@ -1420,10 +1424,6 @@ video { height: 0.625rem; } -.h-14 { - height: 3.5rem; -} - .h-72 { height: 18rem; } @@ -1440,6 +1440,10 @@ video { max-height: 3rem; } +.max-h-full { + max-height: 100%; +} + .max-h-24 { max-height: 6rem; } @@ -1448,10 +1452,6 @@ video { max-height: 16rem; } -.max-h-full { - max-height: 100%; -} - .max-h-60 { max-height: 15rem; } @@ -1530,6 +1530,10 @@ video { width: 1.25rem; } +.w-14 { + width: 3.5rem; +} + .w-1\/2 { width: 50%; } @@ -1620,10 +1624,6 @@ video { width: 2.25rem; } -.w-14 { - width: 3.5rem; -} - .w-2 { width: 0.5rem; } @@ -2356,6 +2356,11 @@ video { border-radius: 0.125rem; } +.rounded-t-lg { + border-top-left-radius: 0.5rem; + border-top-right-radius: 0.5rem; +} + .rounded-b { border-bottom-right-radius: 0.25rem; border-bottom-left-radius: 0.25rem; @@ -2366,11 +2371,6 @@ video { border-bottom-left-radius: 0.5rem; } -.rounded-t-lg { - border-top-left-radius: 0.5rem; - border-top-right-radius: 0.5rem; -} - .rounded-b-\[1rem\] { border-bottom-right-radius: 1rem; border-bottom-left-radius: 1rem; @@ -3302,6 +3302,10 @@ video { padding: 0.125rem; } +.p-6 { + padding: 1.5rem; +} + .p-5 { padding: 1.25rem; } @@ -4963,6 +4967,10 @@ svg.apply-fill path { max-width: 100%; } +.max-w-screen { + max-width: 100vw; +} + /************************* Experimental support for foldable devices ********************************/ @media (horizontal-viewport-segments: 2) { @@ -7562,6 +7570,11 @@ svg.apply-fill path { padding: 0px; } + .md\:px-5 { + padding-left: 1.25rem; + padding-right: 1.25rem; + } + .md\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; diff --git a/src/Logic/Web/ThemeViewStateHashActor.ts b/src/Logic/Web/ThemeViewStateHashActor.ts index d4c75296a..da76842c5 100644 --- a/src/Logic/Web/ThemeViewStateHashActor.ts +++ b/src/Logic/Web/ThemeViewStateHashActor.ts @@ -1,10 +1,10 @@ import ThemeViewState from "../../Models/ThemeViewState" import Hash from "./Hash" import { MenuState } from "../../Models/MenuState" -import hash from "svelte/types/compiler/compile/utils/hash" export default class ThemeViewStateHashActor { private readonly _state: ThemeViewState + private isUpdatingHash = false public static readonly documentation = [ "The URL-hash can contain multiple values:", @@ -49,11 +49,13 @@ export default class ThemeViewStateHashActor { // Register a hash change listener to correctly handle the back button Hash.hash.addCallback((hash) => { - console.trace("Going back with hash", hash) + if(this.isUpdatingHash){ + return + } if (!hash) { this.back() - }else{ - if(!this.loadStateFromHash(hash)){ + } else { + if (!this.loadStateFromHash(hash)) { this.loadSelectedElementFromHash(hash) } } @@ -121,25 +123,30 @@ export default class ThemeViewStateHashActor { * returns 'true' if a hash was set */ private setHash(): boolean { - const selectedElement = this._state.selectedElement.data - if(selectedElement){ - Hash.hash.set(selectedElement.properties.id) - return true - } - for (const page in this._state.guistate.pageStates) { - const toggle = this._state.guistate.pageStates[page] - if (toggle.data) { - Hash.hash.set(page) + this.isUpdatingHash = true + try { + + const selectedElement = this._state.selectedElement.data + if (selectedElement) { + Hash.hash.set(selectedElement.properties.id) return true } + for (const page in this._state.guistate.pageStates) { + const toggle = this._state.guistate.pageStates[page] + if (toggle.data) { + Hash.hash.set(page) + return true + } + } + Hash.hash.set(undefined) + return false + } finally { + this.isUpdatingHash = false } - Hash.hash.set(undefined) - return false } private back() { const state = this._state - console.log("Got a 'back' event") if (state.previewedImage.data) { state.previewedImage.setData(undefined) return diff --git a/src/UI/Base/DrawerLeft.svelte b/src/UI/Base/DrawerLeft.svelte index 44c937a2e..d12ba07ba 100644 --- a/src/UI/Base/DrawerLeft.svelte +++ b/src/UI/Base/DrawerLeft.svelte @@ -9,10 +9,20 @@ duration: 200, easing: sineIn }; + let hidden = !shown.data + $: { + shown.setData(!hidden) + } + shown.addCallback(sh => { + hidden = !sh + }) -