@@ -7,7 +7,6 @@ import FormLabel from "@mui/material/FormLabel";
7
7
import MenuItem from "@mui/material/MenuItem" ;
8
8
import Switch from "@mui/material/Switch" ;
9
9
import TextField from "@mui/material/TextField" ;
10
- import Tooltip from "@mui/material/Tooltip" ;
11
10
import { formatDuration , intervalToDuration } from "date-fns" ;
12
11
import dayjs from "dayjs" ;
13
12
import advancedFormat from "dayjs/plugin/advancedFormat" ;
@@ -19,14 +18,17 @@ import { type FormikTouched, useFormik } from "formik";
19
18
import type { ChangeEvent , FC } from "react" ;
20
19
import * as Yup from "yup" ;
21
20
import type { Template } from "api/typesGenerated" ;
22
- import { DisabledBadge } from "components/Badges/Badges" ;
23
21
import {
24
22
HorizontalForm ,
25
23
FormFooter ,
26
24
FormSection ,
27
25
FormFields ,
28
26
} from "components/Form/Form" ;
29
27
import { Stack } from "components/Stack/Stack" ;
28
+ import {
29
+ StackLabel ,
30
+ StackLabelHelperText ,
31
+ } from "components/StackLabel/StackLabel" ;
30
32
import {
31
33
defaultSchedule ,
32
34
emptySchedule ,
@@ -180,6 +182,10 @@ export const validationSchema = Yup.object({
180
182
} ) ,
181
183
} ) ;
182
184
185
+ // This form utilizes complex, visually-intensive fields. Increasing the space
186
+ // between these fields enhances readability and cleanliness.
187
+ const FIELDS_SPACING = 4 ;
188
+
183
189
export const WorkspaceScheduleForm : FC < WorkspaceScheduleFormProps > = ( {
184
190
error,
185
191
initialValues,
@@ -275,31 +281,30 @@ export const WorkspaceScheduleForm: FC<WorkspaceScheduleFormProps> = ({
275
281
< HorizontalForm onSubmit = { form . handleSubmit } >
276
282
< FormSection
277
283
title = "Autostart"
278
- description = {
279
- < >
280
- < div css = { { marginBottom : 16 } } >
281
- Select the time and days of week on which you want the workspace
282
- starting automatically.
283
- </ div >
284
- { ! template . allow_user_autostart && (
285
- < Tooltip title = "This option can be enabled in the template settings" >
286
- < DisabledBadge />
287
- </ Tooltip >
288
- ) }
289
- </ >
290
- }
284
+ description = "Select the time and days of week on which you want the workspace starting automatically."
291
285
>
292
- < FormFields >
286
+ < FormFields spacing = { FIELDS_SPACING } >
293
287
< FormControlLabel
294
288
control = {
295
289
< Switch
296
290
disabled = { ! template . allow_user_autostart }
297
291
name = "autostartEnabled"
298
292
checked = { form . values . autostartEnabled }
299
293
onChange = { handleToggleAutostart }
294
+ size = "small"
300
295
/>
301
296
}
302
- label = { Language . startSwitch }
297
+ label = {
298
+ < StackLabel >
299
+ { Language . startSwitch }
300
+ { ! template . allow_user_autostart && (
301
+ < StackLabelHelperText >
302
+ The template for this workspace does not allow modification
303
+ of autostart.
304
+ </ StackLabelHelperText >
305
+ ) }
306
+ </ StackLabel >
307
+ }
303
308
/>
304
309
< Stack direction = "row" >
305
310
< TextField
@@ -387,34 +392,37 @@ export const WorkspaceScheduleForm: FC<WorkspaceScheduleFormProps> = ({
387
392
title = "Autostop"
388
393
description = {
389
394
< >
390
- < div css = { { marginBottom : 16 } } >
391
- Set how many hours should elapse after the workspace started
392
- before the workspace automatically shuts down. This will be
393
- extended by{ " " }
394
- { dayjs
395
- . duration ( { milliseconds : template . activity_bump_ms } )
396
- . humanize ( ) } { " " }
397
- after last activity in the workspace was detected.
398
- </ div >
399
- { ! template . allow_user_autostop && (
400
- < Tooltip title = "This option can be enabled in the template settings" >
401
- < DisabledBadge />
402
- </ Tooltip >
403
- ) }
395
+ Set how many hours should elapse after the workspace started before
396
+ the workspace automatically shuts down. This will be extended by{ " " }
397
+ { dayjs
398
+ . duration ( { milliseconds : template . activity_bump_ms } )
399
+ . humanize ( ) } { " " }
400
+ after last activity in the workspace was detected.
404
401
</ >
405
402
}
406
403
>
407
- < FormFields >
404
+ < FormFields spacing = { FIELDS_SPACING } >
408
405
< FormControlLabel
409
406
control = {
410
407
< Switch
408
+ size = "small"
411
409
name = "autostopEnabled"
412
410
checked = { form . values . autostopEnabled }
413
411
onChange = { handleToggleAutostop }
414
412
disabled = { ! template . allow_user_autostop }
415
413
/>
416
414
}
417
- label = { Language . stopSwitch }
415
+ label = {
416
+ < StackLabel >
417
+ { Language . stopSwitch }
418
+ { ! template . allow_user_autostop && (
419
+ < StackLabelHelperText >
420
+ The template for this workspace does not allow modification
421
+ of autostop.
422
+ </ StackLabelHelperText >
423
+ ) }
424
+ </ StackLabel >
425
+ }
418
426
/>
419
427
< TextField
420
428
{ ...formHelpers ( "ttl" , {
0 commit comments