+ )}
{branches?.branches && branches.branches.length > 0 ? (
{branches.branches.map((branch) => {
const isCurrent = branch.name === activeBranch || branch.name === `remotes/${activeBranch}`
const isRemote = branch.type === 'remote'
+ const checkoutName = isRemote ? branch.name.replace(/^remotes\/[^/]+\//, '') : branch.name
+
+ const isCheckedOutElsewhere = branch.isWorktree && !isCurrent
const handleClick = () => {
- if (isCurrent) return
-
- let branchToCheckout = branch.name
- if (isRemote) {
- branchToCheckout = branch.name.replace(/^remotes\/[^/]+\//, '')
- }
- switchBranchMutation.mutate(branchToCheckout)
+ if (isCurrent || isCheckedOutElsewhere) return
+ switchBranchMutation.mutate(checkoutName)
}
return (
)
})}
diff --git a/frontend/src/components/source-control/SourceControlPanel.tsx b/frontend/src/components/source-control/SourceControlPanel.tsx
index 0ecb264c..4994610c 100644
--- a/frontend/src/components/source-control/SourceControlPanel.tsx
+++ b/frontend/src/components/source-control/SourceControlPanel.tsx
@@ -1,7 +1,6 @@
import { useState } from 'react'
-import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import { useGitStatus, getApiErrorMessage } from '@/api/git'
-import { listBranches, switchBranch } from '@/api/repos'
+
import { useGit } from '@/hooks/useGit'
import { ChangesTab } from './ChangesTab'
import { CommitsTab } from './CommitsTab'
@@ -9,7 +8,6 @@ import { BranchesTab } from './BranchesTab'
import { FileDiffView } from '@/components/file-browser/FileDiffView'
import { Button } from '@/components/ui/button'
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog'
-import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@/components/ui/dropdown-menu'
import { GIT_UI_COLORS } from '@/lib/git-status-styles'
import {
Loader2,
@@ -22,8 +20,6 @@ import {
RefreshCw,
ArrowDownFromLine,
X,
- ChevronDown,
- Check,
} from 'lucide-react'
import { cn } from '@/lib/utils'
import { useMobile } from '@/hooks/useMobile'
@@ -34,6 +30,9 @@ interface SourceControlPanelProps {
isOpen: boolean
onClose: () => void
currentBranch: string
+ repoUrl?: string | null
+ isRepoWorktree?: boolean
+ repoName?: string
}
type Tab = 'changes' | 'commits' | 'branches'
@@ -43,32 +42,15 @@ export function SourceControlPanel({
isOpen,
onClose,
currentBranch,
+ repoUrl,
+ isRepoWorktree,
+ repoName,
}: SourceControlPanelProps) {
const [activeTab, setActiveTab] = useState
('changes')
const [selectedFile, setSelectedFile] = useState<{path: string, staged: boolean} | undefined>()
const { data: status } = useGitStatus(repoId)
- const { data: branches } = useQuery({
- queryKey: ['branches', repoId],
- queryFn: () => listBranches(repoId),
- staleTime: 30000,
- })
const git = useGit(repoId)
- const queryClient = useQueryClient()
const isMobile = useMobile()
-
- const switchBranchMutation = useMutation({
- mutationFn: (branch: string) => switchBranch(repoId, branch),
- onSuccess: (updatedRepo) => {
- queryClient.setQueryData(['repo', repoId], updatedRepo)
- queryClient.invalidateQueries({ queryKey: ['repos'] })
- queryClient.invalidateQueries({ queryKey: ['gitStatus', repoId] })
- queryClient.invalidateQueries({ queryKey: ['branches', repoId] })
- },
- onError: (error) => {
- showToast.error(getApiErrorMessage(error))
- },
- })
-
const handleGitAction = async (action: () => Promise) => {
try {
await action()
@@ -91,29 +73,10 @@ export function SourceControlPanel({
-
-
-
-
-
- {branches?.branches?.filter(b => b.type === 'local')?.map((branch) => (
- branch.name !== currentBranch && switchBranchMutation.mutate(branch.name)}
- disabled={branch.name === currentBranch || switchBranchMutation.isPending}
- className="flex items-center gap-2"
- >
-
- {branch.name}
- {branch.name === currentBranch && }
-
- ))}
-
-
+
+
+ {currentBranch}
+
{status && (status.ahead > 0 || status.behind > 0) && (
{status.ahead > 0 && (
@@ -218,7 +181,7 @@ export function SourceControlPanel({
)}
{activeTab === 'branches' && (
-
+
)}
@@ -260,7 +223,7 @@ export function SourceControlPanel({
)}>
- Source Control
+ {isMobile && repoName ? repoName : 'Source Control'}
{isMobile && (
);
diff --git a/package.json b/package.json
index c23f8d26..fe315685 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "opencode-manager",
- "version": "0.7.7",
+ "version": "0.7.8",
"private": false,
"type": "module",
"packageManager": "pnpm@10.28.1",
diff --git a/shared/src/config/env.ts b/shared/src/config/env.ts
index 893d4cb9..859f8d34 100644
--- a/shared/src/config/env.ts
+++ b/shared/src/config/env.ts
@@ -94,7 +94,6 @@ export const ENV = {
ADMIN_EMAIL: process.env.ADMIN_EMAIL,
ADMIN_PASSWORD: process.env.ADMIN_PASSWORD,
ADMIN_PASSWORD_RESET: getEnvBoolean('ADMIN_PASSWORD_RESET', false),
- SECURE_COOKIES: getEnvBoolean('AUTH_SECURE_COOKIES', process.env.NODE_ENV === 'production'),
GITHUB_CLIENT_ID: process.env.GITHUB_CLIENT_ID,
GITHUB_CLIENT_SECRET: process.env.GITHUB_CLIENT_SECRET,
GOOGLE_CLIENT_ID: process.env.GOOGLE_CLIENT_ID,