"use client"; import { Label } from "@/components/ui/label"; import { BranchAutocomplete } from "@/components/ui/branch-autocomplete"; import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; import { cn } from "@/lib/utils"; interface BranchSelectorProps { useCurrentBranch: boolean; onUseCurrentBranchChange: (useCurrent: boolean) => void; branchName: string; onBranchNameChange: (branchName: string) => void; branchSuggestions: string[]; currentBranch?: string; disabled?: boolean; testIdPrefix?: string; } export function BranchSelector({ useCurrentBranch, onUseCurrentBranchChange, branchName, onBranchNameChange, branchSuggestions, currentBranch, disabled = false, testIdPrefix = "branch", }: BranchSelectorProps) { // Validate: if "other branch" is selected, branch name is required const isBranchRequired = !useCurrentBranch; const hasError = isBranchRequired && !branchName.trim(); return (
Branch name is required when "Other branch" is selected.
)}Branch cannot be changed after work has started.
) : ({useCurrentBranch ? "Work will be done in the currently selected branch. A worktree will be created if needed." : "Work will be done in this branch. A worktree will be created if needed."}
)}