mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 21:04:23 +01:00
refactor: add desktop sidebar navigation and consolidate header actions (#199)
* 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
This commit is contained in:
1 parent
3776a7036a
commit
1212e6c6fb
28 files changed
+1286
-612
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { useState } from 'react'
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import { listBranches, switchBranch, GitAuthError } from '@/api/repos'
|
||||
import { listBranches, switchBranch, GitAuthError, getRepo } from '@/api/repos'
|
||||
import { useGitStatus } from '@/api/git'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
@@ -14,11 +14,9 @@ import { CreateWorktreeDialog } from '@/components/repo/CreateWorktreeDialog'
|
||||
interface BranchesTabProps {
|
||||
repoId: number
|
||||
currentBranch: string
|
||||
repoUrl?: string | null
|
||||
isRepoWorktree?: boolean
|
||||
}
|
||||
|
||||
export function BranchesTab({ repoId, currentBranch, repoUrl, isRepoWorktree }: BranchesTabProps) {
|
||||
export function BranchesTab({ repoId, currentBranch }: BranchesTabProps) {
|
||||
const queryClient = useQueryClient()
|
||||
const [newBranchName, setNewBranchName] = useState('')
|
||||
const [isCreating, setIsCreating] = useState(false)
|
||||
@@ -33,6 +31,15 @@ export function BranchesTab({ repoId, currentBranch, repoUrl, isRepoWorktree }:
|
||||
staleTime: 30000,
|
||||
})
|
||||
|
||||
const { data: repo } = useQuery({
|
||||
queryKey: ['repo', repoId],
|
||||
queryFn: () => getRepo(repoId),
|
||||
staleTime: 30000,
|
||||
})
|
||||
|
||||
const repoUrl = repo?.repoUrl ?? null
|
||||
const isRepoWorktree = repo?.isWorktree ?? false
|
||||
|
||||
const switchBranchMutation = useMutation({
|
||||
mutationFn: (branch: string) => switchBranch(repoId, branch),
|
||||
onSuccess: (updatedRepo) => {
|
||||
|
||||
@@ -32,8 +32,6 @@ interface SourceControlPanelProps {
|
||||
isOpen: boolean
|
||||
onClose: () => void
|
||||
currentBranch: string
|
||||
repoUrl?: string | null
|
||||
isRepoWorktree?: boolean
|
||||
repoName?: string
|
||||
}
|
||||
|
||||
@@ -45,8 +43,6 @@ export function SourceControlPanel({
|
||||
isOpen,
|
||||
onClose,
|
||||
currentBranch,
|
||||
repoUrl,
|
||||
isRepoWorktree,
|
||||
repoName,
|
||||
}: SourceControlPanelProps) {
|
||||
const [activeTab, setActiveTab] = useState<Tab>('changes')
|
||||
@@ -224,7 +220,7 @@ export function SourceControlPanel({
|
||||
<CommitsTab repoId={repoId} onSelectCommit={handleSelectCommit} />
|
||||
)}
|
||||
{activeTab === 'branches' && currentView === 'default' && (
|
||||
<BranchesTab repoId={repoId} currentBranch={currentBranch} repoUrl={repoUrl} isRepoWorktree={isRepoWorktree} />
|
||||
<BranchesTab repoId={repoId} currentBranch={currentBranch} />
|
||||
)}
|
||||
|
||||
{currentView === 'commit-detail' && selectedCommit && (
|
||||
|
||||
Reference in new issue
Block a user