1
+ import { type Interpolation , type Theme } from "@emotion/react" ;
1
2
import Checkbox from "@mui/material/Checkbox" ;
2
- import { makeStyles } from "@mui/styles" ;
3
3
import TextField from "@mui/material/TextField" ;
4
- import {
4
+ import type {
5
5
ProvisionerJobLog ,
6
6
Template ,
7
7
TemplateExample ,
8
8
TemplateVersionVariable ,
9
9
VariableValue ,
10
10
} from "api/typesGenerated" ;
11
11
import { Stack } from "components/Stack/Stack" ;
12
- import { TemplateUpload , TemplateUploadProps } from "./TemplateUpload" ;
12
+ import { TemplateUpload , type TemplateUploadProps } from "./TemplateUpload" ;
13
13
import { useFormik } from "formik" ;
14
14
import { SelectedTemplate } from "pages/CreateWorkspacePage/SelectedTemplate" ;
15
- import { FC , useEffect } from "react" ;
15
+ import { type FC , useEffect } from "react" ;
16
16
import {
17
17
nameValidator ,
18
18
getFormHelpers ,
@@ -43,8 +43,8 @@ import {
43
43
} from "pages/TemplateSettingsPage/TemplateSchedulePage/AutostopRequirementHelperText" ;
44
44
import MenuItem from "@mui/material/MenuItem" ;
45
45
import {
46
- TemplateAutostartRequirementDaysValue ,
47
- TemplateAutostopRequirementDaysValue ,
46
+ type TemplateAutostartRequirementDaysValue ,
47
+ type TemplateAutostopRequirementDaysValue ,
48
48
} from "utils/schedule" ;
49
49
import {
50
50
TemplateScheduleAutostart ,
@@ -218,7 +218,6 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = (props) => {
218
218
allowDisableEveryoneAccess,
219
219
allowAutostopRequirement,
220
220
} = props ;
221
- const styles = useStyles ( ) ;
222
221
const form = useFormik < CreateTemplateData > ( {
223
222
initialValues : getInitialValues ( {
224
223
allowAdvancedScheduling,
@@ -338,7 +337,7 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = (props) => {
338
337
description = "Define when workspaces created from this template automatically stop."
339
338
>
340
339
< FormFields >
341
- < Stack direction = "row" className = { styles . ttlFields } >
340
+ < Stack direction = "row" css = { styles . ttlFields } >
342
341
< TextField
343
342
{ ...getFieldHelpers (
344
343
"default_ttl_hours" ,
@@ -373,7 +372,7 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = (props) => {
373
372
</ Stack >
374
373
375
374
{ allowAutostopRequirement && (
376
- < Stack direction = "row" className = { styles . ttlFields } >
375
+ < Stack direction = "row" css = { styles . ttlFields } >
377
376
< TextField
378
377
{ ...getFieldHelpers (
379
378
"autostop_requirement_days_of_week" ,
@@ -481,7 +480,7 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = (props) => {
481
480
< strong >
482
481
Allow users to customize autostop duration for workspaces.
483
482
</ strong >
484
- < span className = { styles . optionHelperText } >
483
+ < span css = { styles . optionHelperText } >
485
484
Workspaces will always use the default TTL if this is set.
486
485
Regardless of this setting, workspaces can only stay on for
487
486
the max TTL.
@@ -514,7 +513,7 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = (props) => {
514
513
direction = "row"
515
514
alignItems = "center"
516
515
spacing = { 0.5 }
517
- className = { styles . optionText }
516
+ css = { styles . optionText }
518
517
>
519
518
< strong >
520
519
Allow users to cancel in-progress workspace jobs
@@ -527,7 +526,7 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = (props) => {
527
526
</ HelpTooltipText >
528
527
</ HelpTooltip >
529
528
</ Stack >
530
- < span className = { styles . optionHelperText } >
529
+ < span css = { styles . optionHelperText } >
531
530
Depending on your template, canceling builds may leave
532
531
workspaces in an unhealthy state. This option isn't
533
532
recommended for most use cases.
@@ -552,7 +551,7 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = (props) => {
552
551
direction = "row"
553
552
alignItems = "center"
554
553
spacing = { 0.5 }
555
- className = { styles . optionText }
554
+ css = { styles . optionText }
556
555
>
557
556
< strong > Allow everyone to use the template</ strong >
558
557
@@ -569,7 +568,7 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = (props) => {
569
568
</ HelpTooltipText >
570
569
</ HelpTooltip >
571
570
</ Stack >
572
- < span className = { styles . optionHelperText } >
571
+ < span css = { styles . optionHelperText } >
573
572
This setting requires an enterprise license for the
574
573
< Link href = { docs ( "/admin/rbac" ) } >
575
574
'Template RBAC'
@@ -610,14 +609,14 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = (props) => {
610
609
611
610
{ jobError && (
612
611
< Stack >
613
- < div className = { styles . error } >
614
- < h5 className = { styles . errorTitle } > Error during provisioning</ h5 >
615
- < p className = { styles . errorDescription } >
612
+ < div css = { styles . error } >
613
+ < h5 css = { styles . errorTitle } > Error during provisioning</ h5 >
614
+ < p css = { styles . errorDescription } >
616
615
Looks like we found an error during the template provisioning. You
617
616
can see the logs bellow.
618
617
</ p >
619
618
620
- < code className = { styles . errorDetails } > { jobError } </ code >
619
+ < code css = { styles . errorDetails } > { jobError } </ code >
621
620
</ div >
622
621
623
622
< WorkspaceBuildLogs logs = { logs ?? [ ] } />
@@ -690,43 +689,43 @@ const MaxTTLHelperText = (props: { ttl?: number }) => {
690
689
) ;
691
690
} ;
692
691
693
- const useStyles = makeStyles ( ( theme ) => ( {
692
+ const styles = {
694
693
ttlFields : {
695
694
width : "100%" ,
696
695
} ,
697
696
698
- optionText : {
697
+ optionText : ( theme ) => ( {
699
698
fontSize : theme . spacing ( 2 ) ,
700
699
color : theme . palette . text . primary ,
701
- } ,
700
+ } ) ,
702
701
703
- optionHelperText : {
702
+ optionHelperText : ( theme ) => ( {
704
703
fontSize : theme . spacing ( 1.5 ) ,
705
704
color : theme . palette . text . secondary ,
706
- } ,
705
+ } ) ,
707
706
708
- error : {
707
+ error : ( theme ) => ( {
709
708
padding : theme . spacing ( 3 ) ,
710
709
borderRadius : theme . spacing ( 1 ) ,
711
710
background : theme . palette . background . paper ,
712
711
border : `1px solid ${ theme . palette . error . main } ` ,
713
- } ,
712
+ } ) ,
714
713
715
714
errorTitle : {
716
715
fontSize : 16 ,
717
716
margin : 0 ,
718
717
} ,
719
718
720
- errorDescription : {
719
+ errorDescription : ( theme ) => ( {
721
720
margin : 0 ,
722
721
color : theme . palette . text . secondary ,
723
722
marginTop : theme . spacing ( 0.5 ) ,
724
- } ,
723
+ } ) ,
725
724
726
- errorDetails : {
725
+ errorDetails : ( theme ) => ( {
727
726
display : "block" ,
728
727
marginTop : theme . spacing ( 1 ) ,
729
728
color : theme . palette . error . light ,
730
729
fontSize : theme . spacing ( 2 ) ,
731
- } ,
732
- } ) ) ;
730
+ } ) ,
731
+ } satisfies Record < string , Interpolation < Theme > > ;
0 commit comments