mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
* refactor: add desktop sidebar navigation and consolidate header actions - Add DesktopSidebar component with collapsible navigation - Add useDesktop and useSidebarAction hooks for sidebar state management - Add useSidebarCollapsed hook with localStorage persistence and error handling - Integrate sidebar into App layout with tooltip support - Remove repoUrl and isRepoWorktree props from SourceControlPanel - BranchesTab now fetches repo data internally using getRepo query - Remove unused to prop from SidebarItem - Simplify RepoList conditional rendering - Add comprehensive test coverage for new components * refactor: remove LSP status button and memory plugin status hook - Delete LspStatusButton component and its test file - Remove unused useMemoryPluginStatus hook from RepoDetail - Clean up dead code as part of desktop header refactor
17 lines
560 B
TypeScript
17 lines
560 B
TypeScript
import { useEffect } from 'react'
|
|
|
|
type SidebarActionKey = 'new-session' | 'new-repo' | 'new-schedule'
|
|
|
|
export function useSidebarAction(action: SidebarActionKey, handler: () => void) {
|
|
useEffect(() => {
|
|
const listener = (event: Event) => {
|
|
const detail = (event as CustomEvent<{ action?: SidebarActionKey }>).detail
|
|
if (detail?.action === action) {
|
|
handler()
|
|
}
|
|
}
|
|
window.addEventListener('oc:sidebar:action', listener)
|
|
return () => window.removeEventListener('oc:sidebar:action', listener)
|
|
}, [action, handler])
|
|
}
|