From 1634c96ecc8ce8a68b93f6eba83fbe7beaaeca61 Mon Sep 17 00:00:00 2001 From: ZhuchkaTriplesix Date: Sun, 15 Nov 2026 06:34:35 +0300 Subject: [PATCH] feat(ui): add empty sidebar shell with resize handle Introduce SidebarShell chrome (glass panel, collapse, drag-resize) and a title-bar toggle, with width/open state persisted in the shell store. Closes #1865 --- apps/tauri/src/App.vue | 18 +++- apps/tauri/src/stores/shell.ts | 49 ++++++++- apps/tauri/src/ui/SidebarShell.vue | 160 +++++++++++++++++++++++++++++ apps/tauri/src/ui/TitleBar.vue | 48 ++++++++- 4 files changed, 267 insertions(+), 8 deletions(-) create mode 100644 apps/tauri/src/ui/SidebarShell.vue diff --git a/apps/tauri/src/App.vue b/apps/tauri/src/App.vue index 6ea5c4bd..1b031a7b 100644 --- a/apps/tauri/src/App.vue +++ b/apps/tauri/src/App.vue @@ -13,6 +13,7 @@ import { } from "./motion"; import QueryaGlass from "./ui/QueryaGlass.vue"; import TitleBar from "./ui/TitleBar.vue"; +import SidebarShell from "./ui/SidebarShell.vue"; const shell = useShellStore(); const motion = provideQueryaMotion(); @@ -62,10 +63,12 @@ function setMotion(level: QueryaMotionLevel) { @@ -175,8 +179,16 @@ function setMotion(level: QueryaMotionLevel) { color: var(--q-foreground); } +.body { + flex: 1; + min-height: 0; + display: flex; + flex-direction: row; +} + .workspace { flex: 1; + min-width: 0; min-height: 0; overflow: auto; } diff --git a/apps/tauri/src/stores/shell.ts b/apps/tauri/src/stores/shell.ts index 97def550..3d4b9bc4 100644 --- a/apps/tauri/src/stores/shell.ts +++ b/apps/tauri/src/stores/shell.ts @@ -1,13 +1,58 @@ import { defineStore } from "pinia"; import { ref } from "vue"; -/** Placeholder shell store — UI chrome lands in later issues. */ +const SIDEBAR_KEY = "querya.sidebar.width"; +const SIDEBAR_OPEN_KEY = "querya.sidebar.open"; +const MIN_WIDTH = 180; +const MAX_WIDTH = 420; +const DEFAULT_WIDTH = 240; + +function readWidth(): number { + const raw = Number(localStorage.getItem(SIDEBAR_KEY)); + if (Number.isFinite(raw) && raw >= MIN_WIDTH && raw <= MAX_WIDTH) return raw; + return DEFAULT_WIDTH; +} + +function readOpen(): boolean { + const raw = localStorage.getItem(SIDEBAR_OPEN_KEY); + if (raw === null) return true; + return raw !== "0"; +} + +/** Shell chrome store — sidebar / ready flags for later connection tree. */ export const useShellStore = defineStore("shell", () => { const ready = ref(false); + const sidebarOpen = ref(readOpen()); + const sidebarWidth = ref(readWidth()); function markReady() { ready.value = true; } - return { ready, markReady }; + function setSidebarOpen(open: boolean) { + sidebarOpen.value = open; + localStorage.setItem(SIDEBAR_OPEN_KEY, open ? "1" : "0"); + } + + function toggleSidebar() { + setSidebarOpen(!sidebarOpen.value); + } + + function setSidebarWidth(width: number) { + const next = Math.min(MAX_WIDTH, Math.max(MIN_WIDTH, Math.round(width))); + sidebarWidth.value = next; + localStorage.setItem(SIDEBAR_KEY, String(next)); + } + + return { + ready, + markReady, + sidebarOpen, + sidebarWidth, + setSidebarOpen, + toggleSidebar, + setSidebarWidth, + minSidebarWidth: MIN_WIDTH, + maxSidebarWidth: MAX_WIDTH, + }; }); diff --git a/apps/tauri/src/ui/SidebarShell.vue b/apps/tauri/src/ui/SidebarShell.vue new file mode 100644 index 00000000..32b63f5a --- /dev/null +++ b/apps/tauri/src/ui/SidebarShell.vue @@ -0,0 +1,160 @@ + + + + + diff --git a/apps/tauri/src/ui/TitleBar.vue b/apps/tauri/src/ui/TitleBar.vue index 9c1b2418..9093be73 100644 --- a/apps/tauri/src/ui/TitleBar.vue +++ b/apps/tauri/src/ui/TitleBar.vue @@ -3,6 +3,7 @@ import { computed, onMounted, onUnmounted, ref } from "vue"; import { getCurrentWindow } from "@tauri-apps/api/window"; import { detectPlatform, type QueryaPlatform } from "./platform"; import { useQueryaMotion } from "../motion"; +import { useShellStore } from "../stores/shell"; const props = withDefaults( defineProps<{ @@ -12,6 +13,7 @@ const props = withDefaults( ); const motion = useQueryaMotion(); +const shell = useShellStore(); const platform = ref(detectPlatform()); const maximized = ref(false); @@ -113,9 +115,22 @@ onUnmounted(() => { /> -
-