From 58f4be0a6167881ccd144319f23a9b0b402fdd0d Mon Sep 17 00:00:00 2001 From: matt Date: Thu, 12 Feb 2026 04:37:49 +0000 Subject: [PATCH] feat(04-01): wire ContextSwitcher into SidebarHeader and add keyboard shortcut - Add ContextSwitcher to SidebarHeader Row 1 with visual separator - Add Cmd+Shift+K shortcut to cycle through available contexts - Add SSH status listener in App.tsx to refresh context list on changes - Shortcut guard: disabled during active context switch Co-Authored-By: Claude Opus 4.6 --- src/renderer/App.tsx | 9 ++++++++ .../components/layout/SidebarHeader.tsx | 15 ++++++++++-- src/renderer/hooks/useKeyboardShortcuts.ts | 23 +++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/renderer/App.tsx b/src/renderer/App.tsx index b08bade7..25089e2b 100644 --- a/src/renderer/App.tsx +++ b/src/renderer/App.tsx @@ -24,6 +24,15 @@ export const App = (): React.JSX.Element => { void useStore.getState().initializeContextSystem(); }, []); + // Refresh available contexts when SSH connection state changes + useEffect(() => { + if (!window.electronAPI.ssh?.onStatus) return; + const cleanup = window.electronAPI.ssh.onStatus(() => { + void useStore.getState().fetchAvailableContexts(); + }); + return cleanup; + }, []); + // Initialize IPC event listeners (notifications, file changes) useEffect(() => { const cleanup = initializeNotificationListeners(); diff --git a/src/renderer/components/layout/SidebarHeader.tsx b/src/renderer/components/layout/SidebarHeader.tsx index d2c12e48..cae456ef 100644 --- a/src/renderer/components/layout/SidebarHeader.tsx +++ b/src/renderer/components/layout/SidebarHeader.tsx @@ -19,6 +19,7 @@ import { truncateMiddle } from '@renderer/utils/stringUtils'; import { Check, ChevronDown, GitBranch, PanelLeft } from 'lucide-react'; import { useShallow } from 'zustand/react/shallow'; +import { ContextSwitcher } from '../common/ContextSwitcher'; import { WorktreeBadge } from '../common/WorktreeBadge'; import type { Worktree, WorktreeSource } from '@renderer/types/data'; @@ -325,7 +326,7 @@ export const SidebarHeader = (): React.JSX.Element => { {/* ROW 1: Project Identity (Title Bar / Drag Region) */}
{ } as React.CSSProperties } > + {/* Context Switcher - workspace indicator */} + + + {/* Visual separator */} +
+ + {/* Project name dropdown button */}