From 3776a3ba653db123022763923f06054b4b27e9d2 Mon Sep 17 00:00:00 2001 From: Hibryda Date: Sat, 7 Mar 2026 23:48:03 +0100 Subject: [PATCH] feat(v3): convert Settings from tab to collapsible side drawer Settings is now a right-side drawer (32em width, semi-transparent backdrop) instead of a full-page tab. GlobalTabBar has 3 tabs (Sessions/Docs/Context) + gear icon toggle. WorkspaceTab type reduced to 'sessions' | 'docs' | 'context'. Close via Escape, click-outside, or close button. Alt+1..3 for tabs, Ctrl+, toggles drawer. --- v2/src/App.svelte | 126 +++++++++++++++--- .../components/Workspace/GlobalTabBar.svelte | 79 +++++++++-- .../components/Workspace/SettingsTab.svelte | 7 +- v2/src/lib/stores/workspace.svelte.ts | 2 +- 4 files changed, 180 insertions(+), 34 deletions(-) diff --git a/v2/src/App.svelte b/v2/src/App.svelte index 75c3149..1485fff 100644 --- a/v2/src/App.svelte +++ b/v2/src/App.svelte @@ -25,10 +25,15 @@ let detachedConfig = getDetachedConfig(); let paletteOpen = $state(false); + let settingsOpen = $state(false); let loaded = $state(false); let activeTab = $derived(getActiveTab()); + function toggleSettings() { + settingsOpen = !settingsOpen; + } + onMount(() => { initTheme(); startAgentDispatcher(); @@ -45,10 +50,10 @@ return; } - // Alt+1..4 — switch workspace tab - if (e.altKey && !e.ctrlKey && e.key >= '1' && e.key <= '4') { + // Alt+1..3 — switch workspace tab + if (e.altKey && !e.ctrlKey && e.key >= '1' && e.key <= '3') { e.preventDefault(); - const tabs = ['sessions', 'docs', 'context', 'settings'] as const; + const tabs = ['sessions', 'docs', 'context'] as const; setActiveTab(tabs[parseInt(e.key) - 1]); return; } @@ -64,10 +69,17 @@ return; } - // Ctrl+, — settings tab + // Ctrl+, — toggle settings drawer if (e.ctrlKey && e.key === ',') { e.preventDefault(); - setActiveTab('settings'); + toggleSettings(); + return; + } + + // Escape — close settings drawer + if (e.key === 'Escape' && settingsOpen) { + e.preventDefault(); + settingsOpen = false; return; } } @@ -99,19 +111,36 @@ {:else if loaded}
- + -
- {#if activeTab === 'sessions'} - - {:else if activeTab === 'docs'} - - {:else if activeTab === 'context'} - - {:else if activeTab === 'settings'} - +
+
+ {#if activeTab === 'sessions'} + + {:else if activeTab === 'docs'} + + {:else if activeTab === 'context'} + + {/if} +
+ + {#if settingsOpen} + + +
settingsOpen = false}>
+ {/if} -
+
@@ -137,11 +166,74 @@ overflow: hidden; } - .tab-content { + .content-area { flex: 1; + position: relative; overflow: hidden; } + .tab-content { + height: 100%; + overflow: hidden; + } + + .drawer-backdrop { + position: absolute; + inset: 0; + background: rgba(0, 0, 0, 0.3); + z-index: 50; + } + + .settings-drawer { + position: absolute; + top: 0; + right: 0; + bottom: 0; + width: 32em; + max-width: 90%; + background: var(--ctp-base); + border-left: 1px solid var(--ctp-surface1); + box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3); + z-index: 51; + display: flex; + flex-direction: column; + overflow: hidden; + } + + .drawer-header { + display: flex; + align-items: center; + justify-content: space-between; + padding: 10px 16px; + border-bottom: 1px solid var(--ctp-surface0); + flex-shrink: 0; + } + + .drawer-header h2 { + font-size: 0.9rem; + font-weight: 600; + color: var(--ctp-text); + margin: 0; + } + + .drawer-close { + display: flex; + align-items: center; + justify-content: center; + width: 24px; + height: 24px; + background: transparent; + border: none; + border-radius: 4px; + color: var(--ctp-subtext0); + cursor: pointer; + } + + .drawer-close:hover { + color: var(--ctp-text); + background: var(--ctp-surface0); + } + .loading { display: flex; align-items: center; diff --git a/v2/src/lib/components/Workspace/GlobalTabBar.svelte b/v2/src/lib/components/Workspace/GlobalTabBar.svelte index 7a59173..7239cd2 100644 --- a/v2/src/lib/components/Workspace/GlobalTabBar.svelte +++ b/v2/src/lib/components/Workspace/GlobalTabBar.svelte @@ -1,37 +1,67 @@ diff --git a/v2/src/lib/components/Workspace/SettingsTab.svelte b/v2/src/lib/components/Workspace/SettingsTab.svelte index 7f17857..afb2a7a 100644 --- a/v2/src/lib/components/Workspace/SettingsTab.svelte +++ b/v2/src/lib/components/Workspace/SettingsTab.svelte @@ -478,14 +478,13 @@