@@ -8,9 +8,10 @@ import TableRow from "@material-ui/core/TableRow"
8
8
import dayjs from "dayjs"
9
9
import relativeTime from "dayjs/plugin/relativeTime"
10
10
import { FC } from "react"
11
- import { Link as RouterLink } from "react-router-dom"
12
11
import * as TypesGen from "../../api/typesGenerated"
13
12
import { AvatarData } from "../../components/AvatarData/AvatarData"
13
+ import { CodeExample } from "../../components/CodeExample/CodeExample"
14
+ import { EmptyState } from "../../components/EmptyState/EmptyState"
14
15
import { Margins } from "../../components/Margins/Margins"
15
16
import { Stack } from "../../components/Stack/Stack"
16
17
import { TableLoader } from "../../components/TableLoader/TableLoader"
@@ -24,9 +25,17 @@ export const Language = {
24
25
nameLabel : "Name" ,
25
26
usedByLabel : "Used by" ,
26
27
lastUpdatedLabel : "Last updated" ,
27
- emptyViewCreateCTA : "Create a template" ,
28
- emptyViewCreate : "to standardize development workspaces for your team." ,
29
- emptyViewNoPerms : "No templates have been created! Contact your Coder administrator." ,
28
+ emptyViewNoPerms : "Contact your Coder administrator to create a template. You can share the code below." ,
29
+ emptyMessage : "Create your first template" ,
30
+ emptyDescription : (
31
+ < >
32
+ To create a workspace you need to have a template. You can{ " " }
33
+ < Link target = "_blank" href = "https://github.com/coder/coder/blob/main/docs/templates.md" >
34
+ create one from scratch
35
+ </ Link > { " " }
36
+ or use a built-in template using the following Coder CLI command:
37
+ </ >
38
+ ) ,
30
39
}
31
40
32
41
export interface TemplatesPageViewProps {
@@ -53,18 +62,12 @@ export const TemplatesPageView: FC<TemplatesPageViewProps> = (props) => {
53
62
{ ! props . loading && ! props . templates ?. length && (
54
63
< TableRow >
55
64
< TableCell colSpan = { 999 } >
56
- < div className = { styles . welcome } >
57
- { props . canCreateTemplate ? (
58
- < span >
59
- < Link component = { RouterLink } to = "/templates/new" >
60
- { Language . emptyViewCreateCTA }
61
- </ Link >
62
- { Language . emptyViewCreate }
63
- </ span >
64
- ) : (
65
- < span > { Language . emptyViewNoPerms } </ span >
66
- ) }
67
- </ div >
65
+ < EmptyState
66
+ message = { Language . emptyMessage }
67
+ description = { props . canCreateTemplate ? Language . emptyDescription : Language . emptyViewNoPerms }
68
+ descriptionClassName = { styles . emptyDescription }
69
+ cta = { < CodeExample code = "coder template init" /> }
70
+ />
68
71
</ TableCell >
69
72
</ TableRow >
70
73
) }
@@ -92,20 +95,9 @@ export const TemplatesPageView: FC<TemplatesPageViewProps> = (props) => {
92
95
93
96
const useStyles = makeStyles ( ( theme ) => ( {
94
97
root : {
95
- marginTop : theme . spacing ( 3 ) ,
98
+ marginTop : theme . spacing ( 10 ) ,
96
99
} ,
97
- welcome : {
98
- paddingTop : theme . spacing ( 12 ) ,
99
- paddingBottom : theme . spacing ( 12 ) ,
100
- display : "flex" ,
101
- flexDirection : "column" ,
102
- alignItems : "center" ,
103
- justifyContent : "center" ,
104
- "& span" : {
105
- maxWidth : 600 ,
106
- textAlign : "center" ,
107
- fontSize : theme . spacing ( 2 ) ,
108
- lineHeight : `${ theme . spacing ( 3 ) } px` ,
109
- } ,
100
+ emptyDescription : {
101
+ maxWidth : theme . spacing ( 62 ) ,
110
102
} ,
111
103
} ) )
0 commit comments