mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
feat: directory files upload system, deferred restart model, cache invalidation consolidation, and misc improvements (#281)
* feat: show variant label on model picker and add folder upload for agents/commands
- Replace three-dot variant menu trigger with selected variant label
- Add POST /api/settings/opencode-directory-files/install endpoint
- Upload agents/commands markdown folders into .config/opencode/{agents,commands}/
- Reload OpenCode server after upload so files are picked up
* fix: revalidate branch/git caches when mobile sheet opens and on vcs.branch.updated SSE
- add shared invalidateRepoGitCaches() helper for consistent invalidation
- revalidate repo list when mobile repo quick-switch sheet opens
- revalidate current repo when mobile More drawer opens
- revalidate repo/git caches when Source Control dialog opens
- handle vcs.branch.updated SSE event with optimistic cache update
- use helper in branch create/switch mutations in useGit and BranchesTab
* style: make variant selector look more like a button with chevron and compact sizing
* refactor: consolidate settings editors, add folder upload support, and clean up unused code
* refactor: consolidate settings editors, add folder upload support, and clean up unused code
* feat: add opencode-directory-files listing service and consolidate settings editors
* fix: distinguish scroll from tap in suggestion popups on touch devices
* refactor: consolidate settings editors and add DirectoryFilesList component
* refactor: target repo status cache updates only to affected batch entries
* refactor: streamline settings, git hooks, and query invalidation logic
This commit is contained in:
1 parent
e53b4fd32c
commit
617962f2dd
48 files changed
+1522
-293
No files matched your search
@@ -1,6 +1,8 @@
|
||||
import { useState } from 'react'
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import { FetchError } from '@opencode-manager/shared'
|
||||
import { useGitStatus, getApiErrorMessage } from '@/api/git'
|
||||
import { getRepo } from '@/api/repos'
|
||||
|
||||
import { useGit } from '@/hooks/useGit'
|
||||
import { ChangesTab } from './ChangesTab'
|
||||
@@ -26,6 +28,8 @@ import {
|
||||
} from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { useMobile } from '@/hooks/useMobile'
|
||||
import { invalidateRepoGitCaches } from '@/lib/queryInvalidation'
|
||||
import { useRefreshOnOpen } from '@/hooks/useRefreshOnOpen'
|
||||
|
||||
interface SourceControlPanelProps {
|
||||
repoId: number
|
||||
@@ -51,8 +55,17 @@ export function SourceControlPanel({
|
||||
const [selectedCommit, setSelectedCommit] = useState<string | undefined>()
|
||||
const [selectedCommitFile, setSelectedCommitFile] = useState<string | undefined>()
|
||||
const [gitError, setGitError] = useState<{ summary: string; detail?: string } | null>(null)
|
||||
const queryClient = useQueryClient()
|
||||
const { data: status } = useGitStatus(repoId)
|
||||
const { data: repo } = useQuery({
|
||||
queryKey: ['repo', repoId],
|
||||
queryFn: () => getRepo(repoId),
|
||||
enabled: isOpen,
|
||||
})
|
||||
const isMobile = useMobile()
|
||||
const displayBranch = repo?.currentBranch || repo?.branch || currentBranch
|
||||
|
||||
useRefreshOnOpen(isOpen, () => { invalidateRepoGitCaches(queryClient, repoId) })
|
||||
|
||||
const handleGitError = (error: unknown) => {
|
||||
if (error instanceof FetchError) {
|
||||
@@ -100,7 +113,7 @@ export function SourceControlPanel({
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<GitBranch className="w-4 h-4 text-muted-foreground" />
|
||||
<span className="text-sm font-medium">{currentBranch}</span>
|
||||
<span className="text-sm font-medium">{displayBranch}</span>
|
||||
</div>
|
||||
{status && (status.ahead > 0 || status.behind > 0) && (
|
||||
<div className="flex items-center gap-1 text-xs text-muted-foreground">
|
||||
@@ -220,7 +233,7 @@ export function SourceControlPanel({
|
||||
<CommitsTab repoId={repoId} onSelectCommit={handleSelectCommit} />
|
||||
)}
|
||||
{activeTab === 'branches' && currentView === 'default' && (
|
||||
<BranchesTab repoId={repoId} currentBranch={currentBranch} />
|
||||
<BranchesTab repoId={repoId} currentBranch={displayBranch} />
|
||||
)}
|
||||
|
||||
{currentView === 'commit-detail' && selectedCommit && (
|
||||
|
||||
Reference in new issue
Block a user