1
+ import Button from "@material-ui/core/Button"
1
2
import Link from "@material-ui/core/Link"
2
3
import { makeStyles , Theme } from "@material-ui/core/styles"
3
4
import Table from "@material-ui/core/Table"
@@ -7,14 +8,16 @@ import TableContainer from "@material-ui/core/TableContainer"
7
8
import TableHead from "@material-ui/core/TableHead"
8
9
import TableRow from "@material-ui/core/TableRow"
9
10
import KeyboardArrowRight from "@material-ui/icons/KeyboardArrowRight"
11
+ import AddIcon from "@material-ui/icons/AddOutlined"
10
12
import useTheme from "@material-ui/styles/useTheme"
11
13
import { AlertBanner } from "components/AlertBanner/AlertBanner"
12
14
import { ChooseOne , Cond } from "components/Conditionals/ChooseOne"
13
15
import { Maybe } from "components/Conditionals/Maybe"
14
16
import { TableEmpty } from "components/TableEmpty/TableEmpty"
17
+ import { useEntitlements } from "hooks/useEntitlements"
15
18
import { FC } from "react"
16
19
import { useTranslation } from "react-i18next"
17
- import { useNavigate } from "react-router-dom"
20
+ import { useNavigate , Link as RouterLink } from "react-router-dom"
18
21
import { createDayString } from "util/createDayString"
19
22
import {
20
23
formatTemplateBuildTime ,
@@ -39,6 +42,7 @@ import {
39
42
HelpTooltipText ,
40
43
HelpTooltipTitle ,
41
44
} from "../../components/Tooltips/HelpTooltip/HelpTooltip"
45
+ import { usePermissions } from "hooks/usePermissions"
42
46
43
47
export const Language = {
44
48
developerCount : ( activeCount : number ) : string => {
@@ -106,10 +110,25 @@ export const TemplatesPageView: FC<
106
110
! props . getOrganizationsError &&
107
111
! props . getTemplatesError &&
108
112
! props . templates ?. length
113
+ const entitlements = useEntitlements ( )
114
+ const permissions = usePermissions ( )
109
115
110
116
return (
111
117
< Margins >
112
- < PageHeader >
118
+ < PageHeader
119
+ actions = {
120
+ < Maybe
121
+ condition = { entitlements . experimental && permissions . createTemplates }
122
+ >
123
+ < Button component = { RouterLink } to = "/starter-templates" >
124
+ Starter templates
125
+ </ Button >
126
+ < Button startIcon = { < AddIcon /> } component = { RouterLink } to = "new" >
127
+ Add template
128
+ </ Button >
129
+ </ Maybe >
130
+ }
131
+ >
113
132
< PageHeaderTitle >
114
133
< Stack spacing = { 1 } direction = "row" alignItems = "center" >
115
134
Templates
0 commit comments