1
1
import Avatar from "@material-ui/core/Avatar"
2
2
import Button from "@material-ui/core/Button"
3
3
import Link from "@material-ui/core/Link"
4
- import { makeStyles , Theme } from "@material-ui/core/styles"
4
+ import { makeStyles } from "@material-ui/core/styles"
5
5
import Table from "@material-ui/core/Table"
6
6
import TableBody from "@material-ui/core/TableBody"
7
7
import TableCell from "@material-ui/core/TableCell"
8
8
import TableHead from "@material-ui/core/TableHead"
9
9
import TableRow from "@material-ui/core/TableRow"
10
10
import AddCircleOutline from "@material-ui/icons/AddCircleOutline"
11
- import useTheme from "@material-ui/styles/useTheme"
12
11
import dayjs from "dayjs"
13
12
import relativeTime from "dayjs/plugin/relativeTime"
14
13
import React from "react"
15
14
import { Link as RouterLink } from "react-router-dom"
16
15
import * as TypesGen from "../../api/typesGenerated"
17
16
import { Margins } from "../../components/Margins/Margins"
18
17
import { Stack } from "../../components/Stack/Stack"
19
- import { combineClasses } from "../../util/combineClasses"
20
18
import { firstLetter } from "../../util/firstLetter"
21
19
22
20
dayjs . extend ( relativeTime )
23
21
24
22
export const Language = {
25
23
createButton : "Create Template" ,
26
- emptyView : "so you can check out your repositories, edit your source code, and build and test your software ." ,
24
+ emptyView : "to standardize development workspaces for your team ." ,
27
25
}
28
26
29
27
export interface TemplatesPageViewProps {
@@ -35,14 +33,11 @@ export interface TemplatesPageViewProps {
35
33
36
34
export const TemplatesPageView : React . FC < TemplatesPageViewProps > = ( props ) => {
37
35
const styles = useStyles ( )
38
- const theme : Theme = useTheme ( )
39
36
return (
40
37
< Stack spacing = { 4 } >
41
38
< Margins >
42
39
< div className = { styles . actions } >
43
- { props . canCreateTemplate && (
44
- < Button startIcon = { < AddCircleOutline /> } > { Language . createButton } </ Button >
45
- ) }
40
+ { props . canCreateTemplate && < Button startIcon = { < AddCircleOutline /> } > { Language . createButton } </ Button > }
46
41
</ div >
47
42
< Table >
48
43
< TableHead >
@@ -57,12 +52,16 @@ export const TemplatesPageView: React.FC<TemplatesPageViewProps> = (props) => {
57
52
< TableRow >
58
53
< TableCell colSpan = { 999 } >
59
54
< div className = { styles . welcome } >
60
- < span >
61
- < Link component = { RouterLink } to = "/templates/new" >
62
- Create a template
63
- </ Link >
64
- { Language . emptyView }
65
- </ span >
55
+ { props . canCreateTemplate ? (
56
+ < span >
57
+ < Link component = { RouterLink } to = "/templates/new" >
58
+ Create a template
59
+ </ Link >
60
+ { Language . emptyView }
61
+ </ span >
62
+ ) : (
63
+ < span > No templates have been created! Contact your Coder administrator.</ span >
64
+ ) }
66
65
</ div >
67
66
</ TableCell >
68
67
</ TableRow >
@@ -77,13 +76,13 @@ export const TemplatesPageView: React.FC<TemplatesPageViewProps> = (props) => {
77
76
</ Avatar >
78
77
< Link component = { RouterLink } to = { `/templates/${ template . id } ` } className = { styles . templateLink } >
79
78
< b > { template . name } </ b >
80
- < span >
81
- { template . description }
82
- </ span >
79
+ < span > { template . description } </ span >
83
80
</ Link >
84
81
</ div >
85
82
</ TableCell >
86
- < TableCell > { template . workspace_owner_count } developer{ template . workspace_owner_count !== 1 && "s" } </ TableCell >
83
+ < TableCell >
84
+ { template . workspace_owner_count } developer{ template . workspace_owner_count !== 1 && "s" }
85
+ </ TableCell >
87
86
< TableCell > { dayjs ( ) . to ( dayjs ( template . updated_at ) ) } </ TableCell >
88
87
</ TableRow >
89
88
)
0 commit comments