'use client'; import { memo, useState } from 'react'; import Link from 'next/link'; import { IconArrowDown, IconArrowLeft, IconBrandVscode, IconChevronDown, IconChevronRight, IconCopy, IconEye, IconFolder, IconGitBranch, IconGitFork, IconGitMerge, IconGitPullRequest, IconLoader2, IconPencil, IconPlayerPlay, IconPlayerStop, } from '@tabler/icons-react'; import { Button } from '@/components/ui/button'; import { CommitStatBadge, LineStat } from '@/components/diff-stat'; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@/components/ui/dropdown-menu'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'; type TaskTopBarProps = { taskTitle?: string; baseBranch?: string; branches?: string[]; branchesLoading?: boolean; onStartAgent?: () => void; onStopAgent?: () => void; isAgentRunning?: boolean; isAgentLoading?: boolean; worktreePath?: string | null; worktreeBranch?: string | null; }; const TaskTopBar = memo(function TaskTopBar({ taskTitle, baseBranch, branches = [], branchesLoading = false, onStartAgent, onStopAgent, isAgentRunning = false, isAgentLoading = false, worktreePath, worktreeBranch, }: TaskTopBarProps) { const [branchName, setBranchName] = useState('feature/agent-ui'); const [isEditingBranch, setIsEditingBranch] = useState(false); const [selectedBaseBranch, setSelectedBaseBranch] = useState(baseBranch ?? 'origin/main'); return (
{taskTitle ?? 'Task details'}
{isEditingBranch ? ( setBranchName(event.target.value)} onBlur={() => setIsEditingBranch(false)} onKeyDown={(event) => { if (event.key === 'Enter' || event.key === 'Escape') { setIsEditingBranch(false); } }} autoFocus /> ) : ( <> {branchName}
Edit branch name Copy branch name
)}
Commits ahead of base Commits behind base
Lines changed {/* Worktree Info */} {worktreePath && (
{worktreePath}
Worktree Path
{worktreePath}
{worktreeBranch && (
Branch: {worktreeBranch}
)}
)}
{/* Start/Stop Agent Button */} {isAgentRunning ? ( Stop the agent ) : ( Start the agent on this task )} Open in editor Pull from remote Open review
Create PR Create PR manually Merge Rebase
); }); export { TaskTopBar };