Skip to content

Commit 765e15a

Browse files
committed
initial mock
1 parent 4c8be34 commit 765e15a

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed

site/src/components/Workspace/Workspace.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { makeStyles } from "@material-ui/core/styles"
22
import { ErrorSummary } from "components/ErrorSummary/ErrorSummary"
3+
import { WorkspaceQuota } from "components/WorkspaceQuota/WorkspaceQuota"
34
import { WorkspaceStatusBadge } from "components/WorkspaceStatusBadge/WorkspaceStatusBadge"
45
import { FC } from "react"
56
import { useNavigate } from "react-router-dom"
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import LinearProgress from '@material-ui/core/LinearProgress';
2+
import { FC } from "react"
3+
import { makeStyles } from "@material-ui/core/styles"
4+
import { MONOSPACE_FONT_FAMILY } from "../../theme/constants"
5+
import Skeleton from '@material-ui/lab/Skeleton';
6+
7+
export interface WorkspaceQuotaProps {
8+
loading: boolean
9+
count?: number
10+
limit?: number
11+
}
12+
13+
export const WorkspaceQuota: FC<WorkspaceQuotaProps> = ({ loading, count, limit }) => {
14+
const styles = useStyles()
15+
16+
const safeCount = count ? count : 0;
17+
const safeLimit = limit ? limit : 100;
18+
const value = Math.round((safeCount / safeLimit) * 100)
19+
const limitLanguage = limit ? limit : `∞`
20+
21+
return (
22+
<div className={styles.root}>
23+
<span>
24+
{loading ? (
25+
<div className={styles.item}>
26+
<div className={styles.quotaBar}>
27+
<LinearProgress
28+
value={value}
29+
color="primary"
30+
/>
31+
</div>
32+
<div className={styles.quotaLabel}>
33+
<Skeleton />
34+
</div>
35+
<div className={styles.quotaLabel}>
36+
FILLER TEXT IDK HOW CSS WORKS
37+
</div>
38+
</div>
39+
) : (
40+
<div className={styles.item}>
41+
<div className={styles.quotaBar}>
42+
<LinearProgress
43+
value={value}
44+
variant="determinate"
45+
color="primary"
46+
/>
47+
</div>
48+
<div className={styles.quotaLabel}>
49+
{safeCount} of {limitLanguage} workspaces used
50+
</div>
51+
</div>
52+
)}
53+
</span>
54+
</div>
55+
)
56+
}
57+
58+
const useStyles = makeStyles((theme) => ({
59+
root: {
60+
paddingLeft: theme.spacing(2),
61+
paddingRight: theme.spacing(2),
62+
borderRadius: theme.shape.borderRadius,
63+
border: `1px solid ${theme.palette.divider}`,
64+
display: "flex",
65+
alignItems: "center",
66+
color: theme.palette.text.secondary,
67+
fontFamily: MONOSPACE_FONT_FAMILY,
68+
margin: "0px",
69+
[theme.breakpoints.down("sm")]: {
70+
display: "block",
71+
},
72+
},
73+
item: {
74+
minWidth: "16%",
75+
padding: theme.spacing(2),
76+
},
77+
quotaBar: {
78+
fontSize: 12,
79+
textTransform: "uppercase",
80+
display: "block",
81+
fontWeight: 600,
82+
wordWrap: "break-word",
83+
paddingTop: theme.spacing(0.5),
84+
},
85+
quotaLabel: {
86+
fontSize: 12,
87+
textTransform: "uppercase",
88+
display: "block",
89+
fontWeight: 600,
90+
wordWrap: "break-word",
91+
paddingTop: theme.spacing(0.5),
92+
},
93+
}))

0 commit comments

Comments
 (0)