Skip to content

Commit 57fc476

Browse files
committed
only on create page
1 parent 6e35d0f commit 57fc476

File tree

7 files changed

+30
-21
lines changed

7 files changed

+30
-21
lines changed

site/src/components/FormFooter/FormFooter.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export const FormFooter: FC<React.PropsWithChildren<FormFooterProps>> = ({
4545
variant="contained"
4646
color="primary"
4747
type="submit"
48+
disabled
4849
>
4950
{submitLabel}
5051
</LoadingButton>

site/src/components/NavbarView/NavbarView.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ export const NavbarView: React.FC<React.PropsWithChildren<NavbarViewProps>> = ({
105105
<NavItems className={styles.desktopNavItems} canViewAuditLog={canViewAuditLog} />
106106

107107
<Stack direction="row" className={styles.profileButton}>
108-
<WorkspaceQuota quota={{ count: 1, limit: 3 }}/>
109108
{user && <UserDropdown user={user} onSignOut={onSignOut} />}
110109
</Stack>
111110
</div>

site/src/components/WorkspaceQuota/WorkspaceQuota.tsx

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,18 @@ export interface WorkspaceQuotaProps {
2020
export const WorkspaceQuota: FC<WorkspaceQuotaProps> = ({ quota }) => {
2121
const styles = useStyles()
2222
quota = {
23-
count: 1,
24-
limit: 10,
23+
count: 3,
24+
limit: 3,
2525
}
26+
// quota = undefined
2627
// loading state
2728
if (quota === undefined) {
2829
return (
2930
<Box>
3031
<Stack spacing={1} className={styles.stack}>
32+
<span className={styles.title}>
33+
Workspace Quota
34+
</span>
3135
<LinearProgress color="primary" />
3236
<div className={styles.label}>
3337
<Skeleton className={styles.skeleton} />
@@ -48,10 +52,14 @@ export const WorkspaceQuota: FC<WorkspaceQuotaProps> = ({ quota }) => {
4852
value = 1
4953
}
5054

55+
5156
return (
5257
<Box>
5358
<Stack spacing={1} className={styles.stack}>
54-
<LinearProgress value={value} variant="determinate" color="primary" />
59+
<span className={styles.title}>
60+
Workspace Quota
61+
</span>
62+
<LinearProgress className={quota.count >= quota.limit ? styles.maxProgress : undefined} value={value} variant="determinate" />
5563
<div className={styles.label}>
5664
{quota.count} {Language.of} {quota.limit}{" "}
5765
{quota.limit === 1 ? Language.workspace : Language.workspaces}{" used"}
@@ -65,6 +73,19 @@ const useStyles = makeStyles((theme) => ({
6573
stack: {
6674
paddingTop: theme.spacing(2.5),
6775
},
76+
maxProgress: {
77+
"& .MuiLinearProgress-colorPrimary": {
78+
backgroundColor: theme.palette.error.main,
79+
},
80+
"& .MuiLinearProgress-barColorPrimary": {
81+
backgroundColor: theme.palette.error.main,
82+
},
83+
},
84+
title: {
85+
fontFamily: MONOSPACE_FONT_FAMILY,
86+
fontSize: 21,
87+
paddingBottom: "8px",
88+
},
6889
label: {
6990
fontFamily: MONOSPACE_FONT_FAMILY,
7091
fontSize: 12,

site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { makeStyles } from "@material-ui/core/styles"
22
import TextField from "@material-ui/core/TextField"
33
import { ErrorSummary } from "components/ErrorSummary/ErrorSummary"
4+
import { WorkspaceQuota } from "components/WorkspaceQuota/WorkspaceQuota"
45
import { FormikContextType, FormikTouched, useFormik } from "formik"
56
import { FC, useState } from "react"
67
import * as Yup from "yup"
@@ -160,6 +161,8 @@ export const CreateWorkspacePageView: FC<React.PropsWithChildren<CreateWorkspace
160161
</Stack>
161162
)}
162163

164+
<WorkspaceQuota />
165+
163166
<FormFooter onCancel={props.onCancel} isLoading={props.creatingWorkspace} />
164167
</>
165168
)}

site/src/pages/TemplatePage/TemplatePageView.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ 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"
1211
import frontMatter from "front-matter"
1312
import { FC } from "react"
1413
import { Link as RouterLink } from "react-router-dom"
@@ -91,7 +90,6 @@ export const TemplatePageView: FC<React.PropsWithChildren<TemplatePageViewProps>
9190
<PageHeader
9291
actions={
9392
<>
94-
{/* <WorkspaceQuota quota={{ count: 1, limit: 3 }}/> */}
9593
<Link
9694
underline="none"
9795
component={RouterLink}

site/src/pages/TemplatesPage/TemplatesPageView.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ 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"
1514
import { FC } from "react"
1615
import { useTranslation } from "react-i18next"
1716
import { useNavigate } from "react-router-dom"
@@ -99,13 +98,7 @@ export const TemplatesPageView: FC<React.PropsWithChildren<TemplatesPageViewProp
9998

10099
return (
101100
<Margins>
102-
<PageHeader
103-
actions={
104-
<>
105-
<WorkspaceQuota quota={{ count: 1, limit: 3 }}/>
106-
</>
107-
}
108-
>
101+
<PageHeader>
109102
<PageHeaderTitle>
110103
<Stack spacing={1} direction="row" alignItems="center">
111104
Templates

site/src/pages/WorkspacesPage/WorkspacesPageView.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,7 @@ export const WorkspacesPageView: FC<React.PropsWithChildren<WorkspacesPageViewPr
4343

4444
return (
4545
<Margins>
46-
<PageHeader
47-
actions={
48-
<>
49-
<WorkspaceQuota quota={{ count: 1, limit: 3 }}/>
50-
</>
51-
}
52-
>
46+
<PageHeader>
5347
<PageHeaderTitle>
5448
<Stack direction="row" spacing={1} alignItems="center">
5549
<span>{Language.pageTitle}</span>

0 commit comments

Comments
 (0)