auto-claude: subtask-1-1 - Replace Select with Combobox for branch selection (#1250)
- Import Combobox component and ComboboxOption type from ./ui/combobox - Convert branches string[] to ComboboxOption[] format using memoized branchOptions - Replace Select component with Combobox in Git Options section - Add i18n translation keys for searchBranches and noBranchesFound in en/fr locales Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,13 +15,7 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { Loader2, ChevronDown, ChevronUp, RotateCcw, FolderTree, GitBranch, Info } from 'lucide-react';
|
import { Loader2, ChevronDown, ChevronUp, RotateCcw, FolderTree, GitBranch, Info } from 'lucide-react';
|
||||||
import { Button } from './ui/button';
|
import { Button } from './ui/button';
|
||||||
import { Label } from './ui/label';
|
import { Label } from './ui/label';
|
||||||
import {
|
import { Combobox, type ComboboxOption } from './ui/combobox';
|
||||||
Select,
|
|
||||||
SelectContent,
|
|
||||||
SelectItem,
|
|
||||||
SelectTrigger,
|
|
||||||
SelectValue
|
|
||||||
} from './ui/select';
|
|
||||||
import { TaskModalLayout } from './task-form/TaskModalLayout';
|
import { TaskModalLayout } from './task-form/TaskModalLayout';
|
||||||
import { TaskFormFields } from './task-form/TaskFormFields';
|
import { TaskFormFields } from './task-form/TaskFormFields';
|
||||||
import { type FileReferenceData } from './task-form/useImageUpload';
|
import { type FileReferenceData } from './task-form/useImageUpload';
|
||||||
@@ -83,6 +77,22 @@ export function TaskCreationWizard({
|
|||||||
return project?.path ?? null;
|
return project?.path ?? null;
|
||||||
}, [projects, projectId]);
|
}, [projects, projectId]);
|
||||||
|
|
||||||
|
// Convert branches to ComboboxOption[] format for searchable dropdown
|
||||||
|
const branchOptions: ComboboxOption[] = useMemo(() => {
|
||||||
|
const options: ComboboxOption[] = [
|
||||||
|
{
|
||||||
|
value: PROJECT_DEFAULT_BRANCH,
|
||||||
|
label: projectDefaultBranch
|
||||||
|
? t('tasks:wizard.gitOptions.useProjectDefaultWithBranch', { branch: projectDefaultBranch })
|
||||||
|
: t('tasks:wizard.gitOptions.useProjectDefault')
|
||||||
|
}
|
||||||
|
];
|
||||||
|
branches.forEach((branch) => {
|
||||||
|
options.push({ value: branch, label: branch });
|
||||||
|
});
|
||||||
|
return options;
|
||||||
|
}, [branches, projectDefaultBranch, t]);
|
||||||
|
|
||||||
// Classification fields
|
// Classification fields
|
||||||
const [category, setCategory] = useState<TaskCategory | ''>('');
|
const [category, setCategory] = useState<TaskCategory | ''>('');
|
||||||
const [priority, setPriority] = useState<TaskPriority | ''>('');
|
const [priority, setPriority] = useState<TaskPriority | ''>('');
|
||||||
@@ -684,31 +694,20 @@ export function TaskCreationWizard({
|
|||||||
<Label htmlFor="base-branch" className="text-sm font-medium text-foreground">
|
<Label htmlFor="base-branch" className="text-sm font-medium text-foreground">
|
||||||
{t('tasks:wizard.gitOptions.baseBranchLabel')}
|
{t('tasks:wizard.gitOptions.baseBranchLabel')}
|
||||||
</Label>
|
</Label>
|
||||||
<Select
|
<Combobox
|
||||||
|
id="base-branch"
|
||||||
value={baseBranch}
|
value={baseBranch}
|
||||||
onValueChange={setBaseBranch}
|
onValueChange={setBaseBranch}
|
||||||
|
options={branchOptions}
|
||||||
|
placeholder={projectDefaultBranch
|
||||||
|
? t('tasks:wizard.gitOptions.useProjectDefaultWithBranch', { branch: projectDefaultBranch })
|
||||||
|
: t('tasks:wizard.gitOptions.useProjectDefault')
|
||||||
|
}
|
||||||
|
searchPlaceholder={t('tasks:wizard.gitOptions.searchBranches')}
|
||||||
|
emptyMessage={t('tasks:wizard.gitOptions.noBranchesFound')}
|
||||||
disabled={isCreating || isLoadingBranches}
|
disabled={isCreating || isLoadingBranches}
|
||||||
>
|
className="h-9"
|
||||||
<SelectTrigger id="base-branch" className="h-9">
|
/>
|
||||||
<SelectValue placeholder={projectDefaultBranch
|
|
||||||
? t('tasks:wizard.gitOptions.useProjectDefaultWithBranch', { branch: projectDefaultBranch })
|
|
||||||
: t('tasks:wizard.gitOptions.useProjectDefault')
|
|
||||||
} />
|
|
||||||
</SelectTrigger>
|
|
||||||
<SelectContent>
|
|
||||||
<SelectItem value={PROJECT_DEFAULT_BRANCH}>
|
|
||||||
{projectDefaultBranch
|
|
||||||
? t('tasks:wizard.gitOptions.useProjectDefaultWithBranch', { branch: projectDefaultBranch })
|
|
||||||
: t('tasks:wizard.gitOptions.useProjectDefault')
|
|
||||||
}
|
|
||||||
</SelectItem>
|
|
||||||
{branches.map((branch) => (
|
|
||||||
<SelectItem key={branch} value={branch}>
|
|
||||||
{branch}
|
|
||||||
</SelectItem>
|
|
||||||
))}
|
|
||||||
</SelectContent>
|
|
||||||
</Select>
|
|
||||||
<p className="text-xs text-muted-foreground">
|
<p className="text-xs text-muted-foreground">
|
||||||
{t('tasks:wizard.gitOptions.helpText')}
|
{t('tasks:wizard.gitOptions.helpText')}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -151,6 +151,8 @@
|
|||||||
"baseBranchLabel": "Base Branch (optional)",
|
"baseBranchLabel": "Base Branch (optional)",
|
||||||
"useProjectDefault": "Use project default",
|
"useProjectDefault": "Use project default",
|
||||||
"useProjectDefaultWithBranch": "Use project default ({{branch}})",
|
"useProjectDefaultWithBranch": "Use project default ({{branch}})",
|
||||||
|
"searchBranches": "Search branches...",
|
||||||
|
"noBranchesFound": "No branches found",
|
||||||
"helpText": "Override the branch this task's worktree will be created from. Leave empty to use the project's configured default branch.",
|
"helpText": "Override the branch this task's worktree will be created from. Leave empty to use the project's configured default branch.",
|
||||||
"useWorktreeLabel": "Use isolated workspace (recommended)",
|
"useWorktreeLabel": "Use isolated workspace (recommended)",
|
||||||
"useWorktreeDescription": "Creates changes in a separate git worktree for safe review before merging. Disable to build directly in your project (faster but riskier)."
|
"useWorktreeDescription": "Creates changes in a separate git worktree for safe review before merging. Disable to build directly in your project (faster but riskier)."
|
||||||
|
|||||||
@@ -151,6 +151,8 @@
|
|||||||
"baseBranchLabel": "Branche de base (optionnel)",
|
"baseBranchLabel": "Branche de base (optionnel)",
|
||||||
"useProjectDefault": "Utiliser la branche par défaut du projet",
|
"useProjectDefault": "Utiliser la branche par défaut du projet",
|
||||||
"useProjectDefaultWithBranch": "Utiliser la branche par défaut du projet ({{branch}})",
|
"useProjectDefaultWithBranch": "Utiliser la branche par défaut du projet ({{branch}})",
|
||||||
|
"searchBranches": "Rechercher des branches...",
|
||||||
|
"noBranchesFound": "Aucune branche trouvée",
|
||||||
"helpText": "Remplacez la branche à partir de laquelle le worktree de cette tâche sera créé. Laissez vide pour utiliser la branche par défaut configurée du projet.",
|
"helpText": "Remplacez la branche à partir de laquelle le worktree de cette tâche sera créé. Laissez vide pour utiliser la branche par défaut configurée du projet.",
|
||||||
"useWorktreeLabel": "Utiliser un espace de travail isolé (recommandé)",
|
"useWorktreeLabel": "Utiliser un espace de travail isolé (recommandé)",
|
||||||
"useWorktreeDescription": "Crée les changements dans un worktree git séparé pour une révision sécurisée avant la fusion. Désactivez pour travailler directement dans votre projet (plus rapide mais risqué)."
|
"useWorktreeDescription": "Crée les changements dans un worktree git séparé pour une révision sécurisée avant la fusion. Désactivez pour travailler directement dans votre projet (plus rapide mais risqué)."
|
||||||
|
|||||||
Reference in New Issue
Block a user