@@ -140,10 +140,16 @@ export const CreateWorkspacePageViewExperimental: FC<
140
140
}
141
141
} , [ error ] ) ;
142
142
143
- const getFieldHelpers = getFormHelpers < TypesGen . CreateWorkspaceRequest > (
144
- form ,
145
- error ,
146
- ) ;
143
+ useEffect ( ( ) => {
144
+ if ( form . submitCount > 0 && form . errors ) {
145
+ const fieldId = `${ id } -workspace-name` ;
146
+ const el = document . getElementById ( fieldId ) ;
147
+ if ( el ) {
148
+ el . scrollIntoView ( { behavior : "smooth" , block : "center" } ) ;
149
+ ( el as HTMLElement ) . focus ?.( ) ;
150
+ }
151
+ }
152
+ } , [ form . submitCount , form . errors , id ] ) ;
147
153
148
154
const [ presetOptions , setPresetOptions ] = useState ( [
149
155
{ label : "None" , value : "" } ,
@@ -333,7 +339,7 @@ export const CreateWorkspacePageViewExperimental: FC<
333
339
< Label className = "text-sm" htmlFor = { `${ id } -workspace-name` } >
334
340
Workspace name
335
341
</ Label >
336
- < div >
342
+ < div className = "flex flex-col" >
337
343
< Input
338
344
id = { `${ id } -workspace-name` }
339
345
value = { form . values . name }
@@ -343,6 +349,11 @@ export const CreateWorkspacePageViewExperimental: FC<
343
349
} }
344
350
disabled = { creatingWorkspace }
345
351
/>
352
+ { form . touched . name && form . errors . name && (
353
+ < div className = "text-content-destructive text-xs mt-2" >
354
+ { form . errors . name }
355
+ </ div >
356
+ ) }
346
357
< div className = "flex gap-2 text-xs text-content-secondary items-center" >
347
358
Need a suggestion?
348
359
< Button
@@ -477,7 +488,6 @@ export const CreateWorkspacePageViewExperimental: FC<
477
488
478
489
return (
479
490
< DynamicParameter
480
- { ...getFieldHelpers ( parameterInputName ) }
481
491
key = { parameter . name }
482
492
parameter = { parameter }
483
493
onChange = { ( value ) =>
0 commit comments