diff --git a/frontend/src/components/tasks/TaskDetailsToolbar.tsx b/frontend/src/components/tasks/TaskDetailsToolbar.tsx index 4040e920..b9c16a06 100644 --- a/frontend/src/components/tasks/TaskDetailsToolbar.tsx +++ b/frontend/src/components/tasks/TaskDetailsToolbar.tsx @@ -11,7 +11,6 @@ import { ArrowDown, Plus, RefreshCw, - FileText, GitPullRequest, } from 'lucide-react'; import { Button } from '@/components/ui/button'; @@ -128,9 +127,6 @@ export function TaskDetailsToolbar({ const [branchStatusLoading, setBranchStatusLoading] = useState(false); const [merging, setMerging] = useState(false); const [rebasing, setRebasing] = useState(false); - const [rebaseSuccess, setRebaseSuccess] = useState(false); - const [showUncommittedWarning, setShowUncommittedWarning] = useState(false); - const [showMergeConfirmDialog, setShowMergeConfirmDialog] = useState(false); const [creatingPR, setCreatingPR] = useState(false); const [showCreatePRDialog, setShowCreatePRDialog] = useState(false); const [prTitle, setPrTitle] = useState(''); @@ -181,14 +177,8 @@ export function TaskDetailsToolbar({ const handleMergeClick = async () => { if (!projectId || !task.id || !selectedAttempt?.id) return; - // Check for uncommitted changes and show warning dialog - if (branchStatus?.has_uncommitted_changes) { - setShowUncommittedWarning(true); - return; - } - - // Show confirmation dialog for regular merge - setShowMergeConfirmDialog(true); + // Directly perform merge without checking branch status + await performMerge(); }; const performMerge = async () => { @@ -209,7 +199,7 @@ export function TaskDetailsToolbar({ // Refetch branch status to show updated state fetchBranchStatus(); } else { - setError('Failed to merge changes'); + setError(result.message || 'Failed to merge changes'); } } else { setError('Failed to merge changes'); @@ -221,24 +211,6 @@ export function TaskDetailsToolbar({ } }; - const handleConfirmMergeWithUncommitted = async () => { - setShowUncommittedWarning(false); - await performMerge(); - }; - - const handleCancelMergeWithUncommitted = () => { - setShowUncommittedWarning(false); - }; - - const handleConfirmMerge = async () => { - setShowMergeConfirmDialog(false); - await performMerge(); - }; - - const handleCancelMerge = () => { - setShowMergeConfirmDialog(false); - }; - const handleRebaseClick = async () => { if (!projectId || !task.id || !selectedAttempt?.id) return; @@ -254,7 +226,6 @@ export function TaskDetailsToolbar({ if (response.ok) { const result: ApiResponse = await response.json(); if (result.success) { - setRebaseSuccess(true); // Refresh branch status after rebase fetchBranchStatus(); } else { @@ -273,6 +244,12 @@ export function TaskDetailsToolbar({ const handleCreatePRClick = async () => { if (!projectId || !task.id || !selectedAttempt?.id) return; + // If PR already exists, open it + if (selectedAttempt.pr_url) { + window.open(selectedAttempt.pr_url, '_blank'); + return; + } + // Auto-fill with task details if available setPrTitle(`${task.title} (vibe-kanban)`); setPrBody(task.description || ''); @@ -540,52 +517,10 @@ export function TaskDetailsToolbar({ return ( <>
- {/* Branch Status Display */} - {selectedAttempt && branchStatus && ( -
-
-
-
- - {branchStatus.up_to_date ? ( - Up to date - ) : branchStatus.is_behind === true ? ( - - {branchStatus.commits_behind} commit - {branchStatus.commits_behind !== 1 ? 's' : ''} behind{' '} - {branchStatus.base_branch_name} - - ) : ( - - {branchStatus.commits_ahead} commit - {branchStatus.commits_ahead !== 1 ? 's' : ''} ahead of{' '} - {branchStatus.base_branch_name} - - )} -
- {branchStatus.has_uncommitted_changes && ( -
- - Uncommitted changes -
- )} -
- - {/* Status Messages */} -
- {branchStatus.merged && ( -
- ✓ Changes have been merged -
- )} - {rebaseSuccess && ( -
- Branch rebased successfully! -
- )} - {error &&
{error}
} -
-
+ {/* Error Display */} + {error && ( +
+
{error}
)} @@ -859,7 +794,11 @@ export function TaskDetailsToolbar({ className="border-blue-300 text-blue-700 hover:bg-blue-50 gap-1" > - {creatingPR ? 'Creating...' : 'Create PR'} + {selectedAttempt.pr_url + ? 'Open PR' + : creatingPR + ? 'Creating...' + : 'Create PR'} - - - - - - {/* Uncommitted Changes Warning Dialog */} - handleCancelMergeWithUncommitted()} - > - - - Uncommitted Changes Detected - - There are uncommitted changes in the worktree that will be - included in the merge. - - -
-
-

- Warning: The worktree contains uncommitted - changes (modified, added, or deleted files) that have not been - committed to git. These changes will be permanently merged into - the {branchStatus?.base_branch_name || 'base'} branch. -

-
-
- - - - -
-
- {/* Create PR Dialog */}