@@ -33,6 +33,9 @@ export function ConfigEditor({ index }: ConfigEditorProps) {
3333 setValue,
3434 } = useFormContext < { config : SingleConfig [ ] } > ( ) ;
3535
36+ const baseId = useId ( ) ;
37+ const generateClientSwitchId = `${ baseId } -generate-client` ;
38+
3639 const configErrors = errors . config ?. [ index ] ;
3740 const webviewerScriptName = useWatch ( {
3841 control,
@@ -148,44 +151,41 @@ export function ConfigEditor({ index }: ConfigEditorProps) {
148151 < FormField
149152 control = { control }
150153 name = { `config.${ index } .generateClient` as const }
151- render = { ( { field } ) => {
152- const switchId = useId ( ) ;
153- return (
154- < FormItem >
155- < FormLabel > Generate</ FormLabel >
156- < FormControl >
157- < div className = "flex w-full items-center" >
158- < SwitchWrapper
159- permanent = { true }
160- className = "w-full inline-grid"
154+ render = { ( { field } ) => (
155+ < FormItem >
156+ < FormLabel > Generate</ FormLabel >
157+ < FormControl >
158+ < div className = "flex w-full items-center" >
159+ < SwitchWrapper
160+ permanent = { true }
161+ className = "w-full inline-grid"
162+ >
163+ < Switch
164+ id = { generateClientSwitchId }
165+ size = "xl"
166+ className = "w-full rounded-md h-10"
167+ thumbClassName = "rounded-md"
168+ checked = { field . value || false }
169+ onCheckedChange = { field . onChange }
170+ />
171+ < SwitchIndicator
172+ state = "off"
173+ className = "w-1/2 text-accent-foreground peer-data-[state=checked]:text-primary"
161174 >
162- < Switch
163- id = { switchId }
164- size = "xl"
165- className = "w-full rounded-md h-10"
166- thumbClassName = "rounded-md"
167- checked = { field . value || false }
168- onCheckedChange = { field . onChange }
169- />
170- < SwitchIndicator
171- state = "off"
172- className = "w-1/2 text-accent-foreground peer-data-[state=checked]:text-primary"
173- >
174- Full Client
175- </ SwitchIndicator >
176- < SwitchIndicator
177- state = "on"
178- className = "w-1/2 text-accent-foreground peer-data-[state=unchecked]:text-primary"
179- >
180- Types Only
181- </ SwitchIndicator >
182- </ SwitchWrapper >
183- </ div >
184- </ FormControl >
185- < FormMessage />
186- </ FormItem >
187- ) ;
188- } }
175+ Full Client
176+ </ SwitchIndicator >
177+ < SwitchIndicator
178+ state = "on"
179+ className = "w-1/2 text-accent-foreground peer-data-[state=unchecked]:text-primary"
180+ >
181+ Types Only
182+ </ SwitchIndicator >
183+ </ SwitchWrapper >
184+ </ div >
185+ </ FormControl >
186+ < FormMessage />
187+ </ FormItem >
188+ ) }
189189 />
190190 </ div >
191191
0 commit comments