@@ -206,81 +206,83 @@ function Content({
206
206
} }
207
207
/>
208
208
</ FormField >
209
- { hasCodeInputs !== null && hasCodeInputs !== undefined && hasCodeInputs && (
210
- < >
211
- < FormField className = 'seam-code-field' >
212
- < InputLabel > { t . codeInputLabel } </ InputLabel >
213
- < TextField
214
- size = 'large'
215
- clearable
216
- hasError = { hasCodeError }
217
- helperText = { responseErrors ?. code ?? errors . code ?. message }
218
- inputProps = { {
219
- ...register ( 'code' , {
220
- required : t . codeRequiredError ,
221
- validate : ( value : string ) =>
222
- validateCodeLength ( device , value ) ,
223
- } ) ,
224
- } }
225
- />
226
- < div
227
- className = { classNames ( 'seam-bottom' , {
228
- 'has-hints' : codeLengthRequirementMessage != null ,
229
- } ) }
230
- >
231
- { codeLengthRequirementMessage != null && (
232
- < ul
233
- className = { classNames ( 'seam-requirements' , {
234
- 'seam-error' : hasCodeError ,
235
- } ) }
236
- >
237
- < li > { codeLengthRequirementMessage } </ li >
238
- < li > { t . codeNumbersOnlyRequirement } </ li >
239
- </ ul >
240
- ) }
241
- < Button
242
- size = 'small'
243
- onMouseDown = { ( e ) => {
244
- e . preventDefault ( ) // Disable stealing input focus
245
- handleGenerateCode ( )
209
+ { hasCodeInputs !== null &&
210
+ hasCodeInputs !== undefined &&
211
+ hasCodeInputs && (
212
+ < >
213
+ < FormField className = 'seam-code-field' >
214
+ < InputLabel > { t . codeInputLabel } </ InputLabel >
215
+ < TextField
216
+ size = 'large'
217
+ clearable
218
+ hasError = { hasCodeError }
219
+ helperText = { responseErrors ?. code ?? errors . code ?. message }
220
+ inputProps = { {
221
+ ...register ( 'code' , {
222
+ required : t . codeRequiredError ,
223
+ validate : ( value : string ) =>
224
+ validateCodeLength ( device , value ) ,
225
+ } ) ,
246
226
} }
247
- disabled = { isGeneratingCode }
227
+ />
228
+ < div
229
+ className = { classNames ( 'seam-bottom' , {
230
+ 'has-hints' : codeLengthRequirementMessage != null ,
231
+ } ) }
248
232
>
249
- { t . codeGenerateButton }
250
- </ Button >
251
- </ div >
252
- </ FormField >
253
- < FormField >
254
- < InputLabel > { t . timingInputLabel } </ InputLabel >
255
- < RadioField
256
- value = { type }
257
- onChange = { setType }
258
- name = 'type'
259
- options = { [
260
- {
261
- label : t . typeOngoingLabel ,
262
- value : 'ongoing' ,
263
- } ,
264
- {
265
- label : t . typeTimeBoundLabel ,
266
- value : 'time_bound' ,
267
- } ,
268
- ] }
269
- />
270
- < >
271
- { type === 'time_bound' && (
272
- < AccessCodeFormTimes
273
- startDate = { startDate }
274
- endDate = { endDate }
275
- onEdit = { ( ) => {
276
- setDatePickerVisible ( true )
233
+ { codeLengthRequirementMessage != null && (
234
+ < ul
235
+ className = { classNames ( 'seam-requirements' , {
236
+ 'seam-error' : hasCodeError ,
237
+ } ) }
238
+ >
239
+ < li > { codeLengthRequirementMessage } </ li >
240
+ < li > { t . codeNumbersOnlyRequirement } </ li >
241
+ </ ul >
242
+ ) }
243
+ < Button
244
+ size = 'small'
245
+ onMouseDown = { ( e ) => {
246
+ e . preventDefault ( ) // Disable stealing input focus
247
+ handleGenerateCode ( )
277
248
} }
278
- />
279
- ) }
280
- </ >
281
- </ FormField >
282
- </ >
283
- ) }
249
+ disabled = { isGeneratingCode }
250
+ >
251
+ { t . codeGenerateButton }
252
+ </ Button >
253
+ </ div >
254
+ </ FormField >
255
+ < FormField >
256
+ < InputLabel > { t . timingInputLabel } </ InputLabel >
257
+ < RadioField
258
+ value = { type }
259
+ onChange = { setType }
260
+ name = 'type'
261
+ options = { [
262
+ {
263
+ label : t . typeOngoingLabel ,
264
+ value : 'ongoing' ,
265
+ } ,
266
+ {
267
+ label : t . typeTimeBoundLabel ,
268
+ value : 'time_bound' ,
269
+ } ,
270
+ ] }
271
+ />
272
+ < >
273
+ { type === 'time_bound' && (
274
+ < AccessCodeFormTimes
275
+ startDate = { startDate }
276
+ endDate = { endDate }
277
+ onEdit = { ( ) => {
278
+ setDatePickerVisible ( true )
279
+ } }
280
+ />
281
+ ) }
282
+ </ >
283
+ </ FormField >
284
+ </ >
285
+ ) }
284
286
{ responseErrors ?. unknown != null && (
285
287
< div className = 'seam-unknown-error' > { responseErrors ?. unknown } </ div >
286
288
) }
0 commit comments