@@ -12,7 +12,7 @@ import {
1212 Text ,
1313 TextArea ,
1414} from "@radix-ui/themes" ;
15- import { useMemo , useRef , useState } from "react" ;
15+ import { useMemo , useState } from "react" ;
1616import { Controller , useForm } from "react-hook-form" ;
1717import { useHotkeys } from "react-hotkeys-hook" ;
1818import { useIntegrations , useRepositories } from "../hooks/useIntegrations" ;
@@ -42,8 +42,6 @@ export function TaskCreate({ open, onOpenChange }: TaskCreateProps) {
4242 const [ isExpanded , setIsExpanded ] = useState ( false ) ;
4343 const [ createMore , setCreateMore ] = useState ( false ) ;
4444 const [ repoPath , setRepoPath ] = useState < string | null > ( null ) ;
45- const [ description , setDescription ] = useState ( "" ) ;
46- const [ selectedRepo , setSelectedRepo ] = useState < string | null > ( null ) ;
4745
4846 const defaultWorkflow = useMemo (
4947 ( ) => workflows . find ( ( w ) => w . is_active && w . is_default ) || workflows [ 0 ] ,
@@ -174,101 +172,129 @@ export function TaskCreate({ open, onOpenChange }: TaskCreateProps) {
174172 />
175173 </ Flex >
176174 < Flex
177- direction = "column"
178- gap = "2"
179- flexGrow = "1"
180- style = { { minHeight : 0 } }
181- >
182- < RichTextEditor
183- value = { description }
184- onChange = { setDescription }
185- repoPath = { repoPath }
186- placeholder = "Add description... Use @ to mention files, or try **bold**, *italic*, `code`, and more!"
187- showToolbar = { true }
188- minHeight = { isExpanded ? "200px" : "120px" }
189- style = { {
190- height : isExpanded ? "100%" : "auto" ,
191- overflow : isExpanded ? "auto" : "visible" ,
192- } }
193- />
194- </ Flex >
175+ direction = "column"
176+ gap = "2"
177+ flexGrow = "1"
178+ style = { { minHeight : 0 } }
179+ >
180+ < Controller
181+ name = "description"
182+ control = { control }
183+ rules = { {
184+ required : true ,
185+ validate : ( v ) => v . trim ( ) . length > 0 ,
186+ } }
187+ render = { ( { field } ) => (
188+ < RichTextEditor
189+ value = { field . value }
190+ onChange = { field . onChange }
191+ repoPath = { repoPath }
192+ placeholder = "Add description... Use @ to mention files, or try **bold**, *italic*, `code`, and more!"
193+ showToolbar = { true }
194+ minHeight = { isExpanded ? "200px" : "120px" }
195+ style = { {
196+ height : isExpanded ? "100%" : "auto" ,
197+ overflow : isExpanded ? "auto" : "visible" ,
198+ } }
199+ />
200+ ) }
201+ />
202+ </ Flex >
195203
196- < Flex gap = "2" align = "end" >
197- { repositories . length > 0 && (
198- < Flex direction = "column" gap = "2" flexGrow = "1" >
199- < Combobox
200- items = { repositories . map ( ( repo ) => ( {
201- value : `${ repo . organization } /${ repo . repository } ` ,
202- label : `${ repo . organization } /${ repo . repository } ` ,
203- } ) ) }
204- value = { selectedRepo }
205- onValueChange = { setSelectedRepo }
206- placeholder = "Select a repository..."
207- searchPlaceholder = "Search repositories..."
208- emptyMessage = "No repositories found"
209- size = "2"
210- side = "top"
211- />
204+ { /* Local Working Directory - Primary Step */ }
205+ < Flex direction = "column" gap = "3" >
206+ < Flex direction = "column" gap = "2" >
207+ < Text size = "2" weight = "medium" color = "gray" >
208+ Local Working Directory
209+ </ Text >
210+ < Button
211+ variant = { repoPath ? "soft" : "classic" }
212+ size = "3"
213+ onClick = { async ( ) => {
214+ const selected = await window . electronAPI ?. selectDirectory ( ) ;
215+ if ( selected ) {
216+ setRepoPath ( selected ) ;
217+ }
218+ } }
219+ style = { {
220+ justifyContent : "flex-start" ,
221+ backgroundColor : repoPath ? "var(--gray-a3)" : undefined ,
222+ } }
223+ >
224+ { repoPath ? (
225+ < >
226+ 📁 { repoPath . split ( '/' ) . pop ( ) || repoPath }
227+ < Text size = "1" color = "gray" ml = "2" >
228+ (Click to change)
229+ </ Text >
230+ </ >
231+ ) : (
232+ "Choose Local Directory"
233+ ) }
234+ </ Button >
212235 </ Flex >
213- ) }
214- < Button
215- variant = "soft"
216- size = "2"
217- onClick = { async ( ) => {
218- const selected = await window . electronAPI ?. selectDirectory ( ) ;
219- if ( selected ) {
220- setRepoPath ( selected ) ;
221- }
222- } }
223- >
224- { repoPath ? "Change Local Repo" : "Select Local Repo for @" }
225- </ Button >
226236
227- < Flex direction = "column" gap = "2" width = "50%" >
228- { workflowOptions . length > 0 && (
229- < Controller
230- name = "workflow"
231- control = { control }
232- rules = { { required : true } }
233- render = { ( { field } ) => (
234- < Combobox
235- items = { workflowOptions }
236- value = { field . value }
237- onValueChange = { field . onChange }
238- placeholder = "Select a workflow..."
239- searchPlaceholder = "Search workflows..."
240- emptyMessage = "No workflows found"
241- size = "2"
242- side = "top"
237+ { /* Configuration Row */ }
238+ < Flex gap = "3" wrap = "wrap" >
239+ { /* Workflow Selection */ }
240+
241+ { workflowOptions . length > 0 && (
242+ < Flex direction = "column" gap = "2" style = { { minWidth : "200px" , flex : 1 } } >
243+ < Text size = "2" weight = "medium" color = "gray" >
244+ Workflow *
245+ </ Text >
246+ < Controller
247+ name = "workflow"
248+ control = { control }
249+ rules = { { required : true } }
250+ render = { ( { field } ) => (
251+ < Combobox
252+ items = { workflowOptions }
253+ value = { field . value }
254+ onValueChange = { field . onChange }
255+ placeholder = "Select a workflow..."
256+ searchPlaceholder = "Search workflows..."
257+ emptyMessage = "No workflows found"
258+ size = "2"
259+ side = "top"
260+ />
261+ ) }
243262 />
244- ) }
245- />
246- ) }
247- </ Flex >
263+ </ Flex >
264+ ) }
248265
249- { repositories . length > 0 && (
250- < Flex direction = "column" gap = "2" width = "50%" >
251- < Controller
252- name = "repository"
253- control = { control }
254- render = { ( { field } ) => (
255- < Combobox
256- items = { repositories . map ( ( repo ) => ( {
257- value : `${ repo . organization } /${ repo . repository } ` ,
258- label : `${ repo . organization } /${ repo . repository } ` ,
259- } ) ) }
260- value = { field . value }
261- onValueChange = { field . onChange }
262- placeholder = "Select a repository..."
263- searchPlaceholder = "Search repositories..."
264- emptyMessage = "No repositories found"
265- size = "2"
266- side = "top"
266+ { /* GitHub Repository Integration */ }
267+ { repositories . length > 0 && (
268+ < Flex direction = "column" gap = "2" style = { { minWidth : "200px" , flex : 1 } } >
269+ < Text size = "2" weight = "medium" color = "gray" >
270+ GitHub Repository
271+ < Text size = "1" color = "gray" ml = "1" >
272+ (For PRs & tracking )
273+ </ Text >
274+ </ Text >
275+ < Controller
276+ name = "repository"
277+ control = { control }
278+ render = { ( { field } ) => (
279+ < Combobox
280+ items = { repositories . map ( ( repo ) => ( {
281+ value : `${ repo . organization } /${ repo . repository } ` ,
282+ label : `${ repo . organization } /${ repo . repository } ` ,
283+ } ) ) }
284+ value = { field . value }
285+ onValueChange = { field . onChange }
286+ placeholder = "Select GitHub repo..."
287+ searchPlaceholder = "Search repositories..."
288+ emptyMessage = "No repositories found"
289+ size = "2"
290+ side = "top"
291+ />
292+ ) }
267293 />
268- ) }
269- />
294+ </ Flex >
295+ ) }
270296 </ Flex >
271- ) }
297+ </ Flex >
272298
273299 < Flex gap = "3" justify = "end" align = "end" >
274300 < Text as = "label" size = "1" style = { { cursor : "pointer" } } >
@@ -288,7 +314,6 @@ export function TaskCreate({ open, onOpenChange }: TaskCreateProps) {
288314 </ Button >
289315 </ Flex >
290316 </ Flex >
291- </ Flex >
292317 </ form >
293318 </ Flex >
294319 </ Dialog . Content >
0 commit comments