Skip to content

Commit 6e35d0f

Browse files
committed
demoable
1 parent 158ac78 commit 6e35d0f

File tree

6 files changed

+63
-52
lines changed

6 files changed

+63
-52
lines changed

site/src/components/Navbar/Navbar.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ export const Navbar: React.FC = () => {
1414
selectFeatureVisibility,
1515
shallowEqual,
1616
)
17-
const canViewAuditLog =
18-
featureVisibility[FeatureNames.AuditLog] && Boolean(permissions?.viewAuditLog)
19-
const canViewWorkspaceQuota = featureVisibility[FeatureNames.WorkspaceQuota]
17+
const canViewAuditLog = featureVisibility[FeatureNames.AuditLog] && Boolean(permissions?.viewAuditLog)
2018
const onSignOut = () => authSend("SIGN_OUT")
2119

22-
return <NavbarView user={me} onSignOut={onSignOut} canViewAuditLog={canViewAuditLog} canViewWorkspaceQuota={canViewWorkspaceQuota}/>
20+
return <NavbarView user={me} onSignOut={onSignOut} canViewAuditLog={canViewAuditLog} />
2321
}

site/src/components/NavbarView/NavbarView.tsx

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export interface NavbarViewProps {
1919
user?: TypesGen.User
2020
onSignOut: () => void
2121
canViewAuditLog: boolean
22-
canViewWorkspaceQuota: boolean
22+
quota?: TypesGen.UserWorkspaceQuota
2323
}
2424

2525
export const Language = {
@@ -72,7 +72,6 @@ export const NavbarView: React.FC<React.PropsWithChildren<NavbarViewProps>> = ({
7272
user,
7373
onSignOut,
7474
canViewAuditLog,
75-
canViewWorkspaceQuota,
7675
}) => {
7776
const styles = useStyles()
7877
const [isDrawerOpen, setIsDrawerOpen] = useState(false)
@@ -105,30 +104,18 @@ export const NavbarView: React.FC<React.PropsWithChildren<NavbarViewProps>> = ({
105104

106105
<NavItems className={styles.desktopNavItems} canViewAuditLog={canViewAuditLog} />
107106

108-
<div className={styles.profileButton}>
107+
<Stack direction="row" className={styles.profileButton}>
108+
<WorkspaceQuota quota={{ count: 1, limit: 3 }}/>
109109
{user && <UserDropdown user={user} onSignOut={onSignOut} />}
110-
</div>
110+
</Stack>
111111
</div>
112-
<Stack direction="row" className={styles.profileButton}>
113-
<div className={styles.quota}>
114-
<WorkspaceQuota />
115-
</div>
116112

117-
<div className={styles.profileButton}>
118-
{user && <UserDropdown user={user} onSignOut={onSignOut} />}
119-
</div>
120-
</Stack>
121113
</nav>
122114
)
123115
}
124116

125117
const useStyles = makeStyles((theme) => ({
126118
root: {
127-
position: "relative",
128-
display: "flex",
129-
justifyContent: "space-between",
130-
alignItems: "center",
131-
alignContent: "center",
132119
height: navHeight,
133120
background: theme.palette.background.paper,
134121
"@media (display-mode: standalone)": {

site/src/components/WorkspaceQuota/WorkspaceQuota.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ export interface WorkspaceQuotaProps {
1919

2020
export const WorkspaceQuota: FC<WorkspaceQuotaProps> = ({ quota }) => {
2121
const styles = useStyles()
22-
22+
quota = {
23+
count: 1,
24+
limit: 10,
25+
}
2326
// loading state
2427
if (quota === undefined) {
2528
return (
@@ -60,7 +63,7 @@ export const WorkspaceQuota: FC<WorkspaceQuotaProps> = ({ quota }) => {
6063

6164
const useStyles = makeStyles((theme) => ({
6265
stack: {
63-
display: "inline-flex",
66+
paddingTop: theme.spacing(2.5),
6467
},
6568
label: {
6669
fontFamily: MONOSPACE_FONT_FAMILY,

site/src/pages/TemplatePage/TemplatePageView.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { DeleteButton } from "components/DropdownButton/ActionCtas"
88
import { DropdownButton } from "components/DropdownButton/DropdownButton"
99
import { ErrorSummary } from "components/ErrorSummary/ErrorSummary"
1010
import { Markdown } from "components/Markdown/Markdown"
11+
import { WorkspaceQuota } from "components/WorkspaceQuota/WorkspaceQuota"
1112
import frontMatter from "front-matter"
1213
import { FC } from "react"
1314
import { Link as RouterLink } from "react-router-dom"
@@ -77,6 +78,7 @@ export const TemplatePageView: FC<React.PropsWithChildren<TemplatePageViewProps>
7778

7879
const createWorkspaceButton = (className?: string) => (
7980
<Link underline="none" component={RouterLink} to={`/templates/${template.name}/workspace`}>
81+
{/* <Button className={className ?? ""} startIcon={<AddCircleOutline />} disabled> */}
8082
<Button className={className ?? ""} startIcon={<AddCircleOutline />}>
8183
{Language.createButton}
8284
</Button>
@@ -89,6 +91,7 @@ export const TemplatePageView: FC<React.PropsWithChildren<TemplatePageViewProps>
8991
<PageHeader
9092
actions={
9193
<>
94+
{/* <WorkspaceQuota quota={{ count: 1, limit: 3 }}/> */}
9295
<Link
9396
underline="none"
9497
component={RouterLink}

site/src/pages/TemplatesPage/TemplatesPageView.tsx

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import useTheme from "@material-ui/styles/useTheme"
1111
import { ChooseOne, Cond } from "components/Conditionals/ChooseOne"
1212
import { Maybe } from "components/Conditionals/Maybe"
1313
import { ErrorSummary } from "components/ErrorSummary/ErrorSummary"
14+
import { WorkspaceQuota } from "components/WorkspaceQuota/WorkspaceQuota"
1415
import { FC } from "react"
1516
import { useTranslation } from "react-i18next"
1617
import { useNavigate } from "react-router-dom"
@@ -98,34 +99,39 @@ export const TemplatesPageView: FC<React.PropsWithChildren<TemplatesPageViewProp
9899

99100
return (
100101
<Margins>
101-
<PageHeader>
102-
<PageHeaderTitle>
103-
<Stack spacing={1} direction="row" alignItems="center">
104-
Templates
105-
<TemplateHelpTooltip />
106-
</Stack>
107-
</PageHeaderTitle>
108-
<Maybe condition={Boolean(props.templates && props.templates.length > 0)}>
109-
<PageHeaderSubtitle>
110-
Choose a template to create a new workspace
111-
{props.canCreateTemplate ? (
112-
<>
113-
, or{" "}
114-
<Link
115-
href="https://coder.com/docs/coder-oss/latest/templates#add-a-template"
116-
target="_blank"
117-
>
118-
manage templates
119-
</Link>{" "}
120-
from the CLI.
121-
</>
122-
) : (
123-
"."
124-
)}
125-
</PageHeaderSubtitle>
126-
</Maybe>
127-
</PageHeader>
128-
102+
<PageHeader
103+
actions={
104+
<>
105+
<WorkspaceQuota quota={{ count: 1, limit: 3 }}/>
106+
</>
107+
}
108+
>
109+
<PageHeaderTitle>
110+
<Stack spacing={1} direction="row" alignItems="center">
111+
Templates
112+
<TemplateHelpTooltip />
113+
</Stack>
114+
</PageHeaderTitle>
115+
<Maybe condition={Boolean(props.templates && props.templates.length > 0)}>
116+
<PageHeaderSubtitle>
117+
Choose a template to create a new workspace
118+
{props.canCreateTemplate ? (
119+
<>
120+
, or{" "}
121+
<Link
122+
href="https://coder.com/docs/coder-oss/latest/templates#add-a-template"
123+
target="_blank"
124+
>
125+
manage templates
126+
</Link>{" "}
127+
from the CLI.
128+
</>
129+
) : (
130+
"."
131+
)}
132+
</PageHeaderSubtitle>
133+
</Maybe>
134+
</PageHeader>
129135
<ChooseOne>
130136
<Cond condition={Boolean(props.getOrganizationsError)}>
131137
<ErrorSummary
@@ -278,4 +284,11 @@ const useStyles = makeStyles((theme) => ({
278284
width: "100%",
279285
},
280286
},
287+
quota: {
288+
[theme.breakpoints.up("md")]: {
289+
marginLeft: "auto",
290+
},
291+
paddingTop: theme.spacing(6),
292+
paddingBottom: theme.spacing(5),
293+
},
281294
}))

site/src/pages/WorkspacesPage/WorkspacesPageView.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Link from "@material-ui/core/Link"
2+
import { WorkspaceQuota } from "components/WorkspaceQuota/WorkspaceQuota"
23
import { FC } from "react"
34
import { Link as RouterLink } from "react-router-dom"
45
import { Margins } from "../../components/Margins/Margins"
@@ -42,7 +43,13 @@ export const WorkspacesPageView: FC<React.PropsWithChildren<WorkspacesPageViewPr
4243

4344
return (
4445
<Margins>
45-
<PageHeader>
46+
<PageHeader
47+
actions={
48+
<>
49+
<WorkspaceQuota quota={{ count: 1, limit: 3 }}/>
50+
</>
51+
}
52+
>
4653
<PageHeaderTitle>
4754
<Stack direction="row" spacing={1} alignItems="center">
4855
<span>{Language.pageTitle}</span>

0 commit comments

Comments
 (0)