From 5622b3335d42d7c411149765a7cce5bc57a7bb7c Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 31 May 2025 07:24:11 +0000 Subject: [PATCH] feat: Add configurable persistent desktop navbar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit introduces a new behavior for the desktop navbar, allowing it to remain open until the menu button is clicked again. This behavior is controlled by a new option in your settings. Changes include: - **Configuration Store (`useUi.js`):** - Added a new boolean state `desktopNavbarPersistent` (default: `false`). - Added an action `setDesktopNavbarPersistent` to modify this state. - Ensured this setting is persisted to and loaded from local storage. - **TopBar Component (`TopBar.vue`):** - Verified that the hamburger menu button is visible on desktop screens to allow toggling the navbar. - **NavBar Component (`NavBar.vue`):** - Modified the navigation link click handler: - If `desktopNavbarPersistent` is true and in desktop view (>=768px), clicking a link will no longer close the sidebar. - In mobile view or when `desktopNavbarPersistent` is false, links will still close the sidebar. - The '✕' close button in the NavBar continues to toggle the sidebar visibility. - **Settings View (`SettingsView.vue`):** - Added a new checkbox in the "General" settings section to allow you to enable or disable the "Persistent Desktop Navbar" feature. This addresses the issue where you wanted the navbar to be less intrusive and only close upon an explicit second click of the menu button in desktop environments. --- ui/src/components/ui/NavBar.vue | 11 ++++++++++- ui/src/stores/useUi.js | 6 ++++++ ui/src/views/SettingsView.vue | 5 +++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ui/src/components/ui/NavBar.vue b/ui/src/components/ui/NavBar.vue index 957b1d5..c305835 100644 --- a/ui/src/components/ui/NavBar.vue +++ b/ui/src/components/ui/NavBar.vue @@ -21,6 +21,15 @@ watch(route, v => (activePath.value = v.path)) // clases dinámicas p/ mostrar / ocultar barra const sidebarClasses = computed(() => ui.sidebarOpen ? 'translate-x-0' : '-translate-x-full') + +const handleLinkClick = () => { + // Close sidebar if desktopNavbarPersistent is false or if it's mobile view (width < 768px) + // Assuming 768px is the 'md' breakpoint. + if (!ui.desktopNavbarPersistent || window.innerWidth < 768) { + ui.closeSidebar() + } + // Otherwise, (desktopNavbarPersistent is true AND width >= 768px), do nothing to keep sidebar open. +}