@@ -5,17 +5,9 @@ import type { WorktreeDefaultsResponse, BranchInfo, WorktreeIncludeStatus } from
55
66import { vscode } from "@/utils/vscode"
77import { useAppTranslation } from "@/i18n/TranslationContext"
8- import {
9- Dialog ,
10- DialogContent ,
11- DialogDescription ,
12- DialogFooter ,
13- DialogHeader ,
14- DialogTitle ,
15- Button ,
16- Input ,
17- } from "@/components/ui"
8+ import { Dialog , DialogContent , DialogFooter , DialogHeader , DialogTitle , Button , Input } from "@/components/ui"
189import { SearchableSelect , type SearchableSelectOption } from "@/components/ui/searchable-select"
10+ import { CornerDownRight , Folder , FolderSearch , Info } from "lucide-react"
1911
2012interface CreateWorktreeModalProps {
2113 open : boolean
@@ -81,6 +73,12 @@ export const CreateWorktreeModal = ({
8173 setIncludeStatus ( message . worktreeIncludeStatus )
8274 break
8375 }
76+ case "folderSelected" : {
77+ if ( message . path ) {
78+ setWorktreePath ( message . path )
79+ }
80+ break
81+ }
8482 case "worktreeCopyProgress" : {
8583 setCopyProgress ( {
8684 bytesCopied : message . copyProgressBytesCopied ?? 0 ,
@@ -152,14 +150,13 @@ export const CreateWorktreeModal = ({
152150 < DialogContent className = "max-w-lg" >
153151 < DialogHeader >
154152 < DialogTitle > { t ( "worktrees:createWorktree" ) } </ DialogTitle >
155- < DialogDescription > { t ( "worktrees:createWorktreeDescription" ) } </ DialogDescription >
156153 </ DialogHeader >
157154
158155 < div className = "flex flex-col gap-3" >
159156 { /* No .worktreeinclude warning - shows when the current worktree doesn't have .worktreeinclude */ }
160157 { includeStatus ?. exists === false && (
161158 < div className = "flex items-center gap-2 px-3 py-2 rounded-lg bg-vscode-inputValidation-warningBackground border border-vscode-inputValidation-warningBorder text-sm" >
162- < span className = "codicon codicon-warning text-vscode-charts-yellow flex-shrink-0" />
159+ < Info />
163160 < span className = "text-vscode-foreground" >
164161 < span className = "font-medium" > { t ( "worktrees:noIncludeFileWarning" ) } </ span >
165162 { " — " }
@@ -170,17 +167,6 @@ export const CreateWorktreeModal = ({
170167 </ div >
171168 ) }
172169
173- { /* Branch name */ }
174- < div className = "flex flex-col gap-1" >
175- < label className = "text-sm text-vscode-foreground" > { t ( "worktrees:branchName" ) } </ label >
176- < Input
177- value = { branchName }
178- onChange = { ( e ) => setBranchName ( e . target . value ) }
179- placeholder = { defaults ?. suggestedBranch || "worktree/feature-name" }
180- className = "rounded-full"
181- />
182- </ div >
183-
184170 { /* Base branch selector */ }
185171 < div className = "flex flex-col gap-1" >
186172 < label className = "text-sm text-vscode-foreground" > { t ( "worktrees:baseBranch" ) } </ label >
@@ -201,16 +187,32 @@ export const CreateWorktreeModal = ({
201187 ) }
202188 </ div >
203189
190+ { /* Branch name */ }
191+ < div className = "flex items-center gap-2" >
192+ < CornerDownRight className = "size-4 ml-2 shrink-0" />
193+ < label className = "text-sm text-vscode-foreground shrink-0" > { t ( "worktrees:branchName" ) } </ label >
194+ < Input
195+ value = { branchName }
196+ onChange = { ( e ) => setBranchName ( e . target . value ) }
197+ placeholder = { defaults ?. suggestedBranch || "worktree/feature-name" }
198+ className = "rounded-full"
199+ />
200+ </ div >
201+
204202 { /* Worktree path */ }
205- < div className = "flex flex-col gap-1" >
206- < label className = "text-sm text-vscode-foreground" > { t ( "worktrees:worktreePath" ) } </ label >
203+ < div className = "flex items-center gap-2 relative" >
204+ < Folder className = "size-4 ml-2 shrink-0" />
205+ < label className = "text-sm text-vscode-foreground shrink-0" > { t ( "worktrees:worktreePath" ) } </ label >
207206 < Input
208207 value = { worktreePath }
209208 onChange = { ( e ) => setWorktreePath ( e . target . value ) }
210209 placeholder = { defaults ?. suggestedPath || "/path/to/worktree" }
211- className = "rounded-full"
210+ className = "rounded-full flex-1 pr-9"
211+ />
212+ < FolderSearch
213+ className = "size-4 shrink-0 absolute right-3 cursor-pointer hover:opacity-75 transition-opacity"
214+ onClick = { ( ) => vscode . postMessage ( { type : "browseForWorktreePath" } ) }
212215 />
213- < p className = "text-xs text-vscode-descriptionForeground" > { t ( "worktrees:pathHint" ) } </ p >
214216 </ div >
215217
216218 { /* Error message */ }
@@ -244,7 +246,7 @@ export const CreateWorktreeModal = ({
244246 < Button variant = "secondary" onClick = { onClose } disabled = { isCreating } >
245247 { t ( "worktrees:cancel" ) }
246248 </ Button >
247- < Button onClick = { handleCreate } disabled = { ! isValid || isCreating } >
249+ < Button variant = "primary" onClick = { handleCreate } disabled = { ! isValid || isCreating } >
248250 { isCreating ? (
249251 < >
250252 < span className = "codicon codicon-loading codicon-modifier-spin mr-2" />
0 commit comments