97 lines
3.9 KiB
Markdown
97 lines
3.9 KiB
Markdown
---
|
|
phase: 04-workspace-ui
|
|
plan: 01
|
|
subsystem: ui
|
|
tags: [react, zustand, lucide-react, keyboard-shortcuts, dropdown]
|
|
|
|
requires:
|
|
- phase: 03-state-management
|
|
provides: contextSlice with switchContext, activeContextId, isContextSwitching
|
|
- phase: 02-service-infrastructure
|
|
provides: context.list() IPC, context.switch() IPC, ssh.onStatus() listener
|
|
provides:
|
|
- ContextSwitcher dropdown component listing Local + SSH workspaces with status badges
|
|
- ConnectionStatusBadge icon component with 4 visual states
|
|
- Cmd+Shift+K keyboard shortcut for workspace cycling
|
|
- availableContexts state and fetchAvailableContexts action in contextSlice
|
|
- SSH status listener in App.tsx refreshing context list on changes
|
|
affects: [04-02-workspace-settings]
|
|
|
|
tech-stack:
|
|
added: []
|
|
patterns: [sidebar-header-dropdown-pattern, connection-status-icon-states]
|
|
|
|
key-files:
|
|
created:
|
|
- src/renderer/components/common/ContextSwitcher.tsx
|
|
- src/renderer/components/common/ConnectionStatusBadge.tsx
|
|
modified:
|
|
- src/renderer/store/slices/contextSlice.ts
|
|
- src/renderer/components/layout/SidebarHeader.tsx
|
|
- src/renderer/hooks/useKeyboardShortcuts.ts
|
|
- src/renderer/App.tsx
|
|
|
|
key-decisions:
|
|
- "ContextSwitcher placed first in SidebarHeader Row 1, before project name, with vertical separator"
|
|
- "Cmd+Shift+K check placed before Cmd+K to avoid shortcut shadowing"
|
|
- "SSH status listener refreshes available contexts automatically on connection changes"
|
|
|
|
patterns-established:
|
|
- "ConnectionStatusBadge: 4-state icon rendering (Monitor/local, Wifi/green connected, Loader2/spinner connecting, WifiOff/muted disconnected, WifiOff/red error)"
|
|
- "Context switcher dropdown follows SidebarHeader dropdown pattern (useRef, outside click, escape key)"
|
|
|
|
duration: 6min
|
|
completed: 2026-02-12
|
|
---
|
|
|
|
# Plan 04-01: Context Switcher Summary
|
|
|
|
**ContextSwitcher dropdown in SidebarHeader with ConnectionStatusBadge icons and Cmd+Shift+K workspace cycling**
|
|
|
|
## Performance
|
|
|
|
- **Duration:** 6 min
|
|
- **Completed:** 2026-02-12
|
|
- **Tasks:** 2
|
|
- **Files modified:** 6
|
|
|
|
## Accomplishments
|
|
- ContextSwitcher dropdown in sidebar header listing Local + SSH workspaces with connection status badges
|
|
- ConnectionStatusBadge component with 4 distinct visual states (local/connected/connecting/disconnected/error)
|
|
- Cmd+Shift+K keyboard shortcut for cycling through available workspaces
|
|
- Automatic context list refresh when SSH connection state changes
|
|
|
|
## Task Commits
|
|
|
|
1. **Task 1: Create ConnectionStatusBadge and ContextSwitcher components** - `ca60158` (feat)
|
|
2. **Task 2: Wire ContextSwitcher into SidebarHeader and add keyboard shortcut** - `58f4be0` (feat)
|
|
|
|
## Files Created/Modified
|
|
- `src/renderer/components/common/ConnectionStatusBadge.tsx` - Icon component rendering 4 connection states
|
|
- `src/renderer/components/common/ContextSwitcher.tsx` - Dropdown listing local + SSH contexts with switch-on-click
|
|
- `src/renderer/store/slices/contextSlice.ts` - Added availableContexts state and fetchAvailableContexts action
|
|
- `src/renderer/components/layout/SidebarHeader.tsx` - Added ContextSwitcher to Row 1 with separator
|
|
- `src/renderer/hooks/useKeyboardShortcuts.ts` - Added Cmd+Shift+K before Cmd+K
|
|
- `src/renderer/App.tsx` - Added SSH status listener for context refresh
|
|
|
|
## Decisions Made
|
|
- ContextSwitcher placed first in Row 1 (before project name) with vertical divider separator
|
|
- Cmd+Shift+K must come before Cmd+K in the handler to avoid shortcut shadowing
|
|
- Row 1 layout changed from justify-between to gap-2 with ml-auto on collapse button
|
|
|
|
## Deviations from Plan
|
|
None - plan executed exactly as written
|
|
|
|
## Issues Encountered
|
|
None
|
|
|
|
## User Setup Required
|
|
None - no external service configuration required.
|
|
|
|
## Next Phase Readiness
|
|
- Context switcher is functional and ready for 04-02 (workspace settings) to add SSH profile CRUD
|
|
- fetchAvailableContexts is called by WorkspaceSection after profile changes
|
|
|
|
---
|
|
*Phase: 04-workspace-ui*
|
|
*Completed: 2026-02-12*
|