Skip to content

Commit 212c4ef

Browse files
committed
Refactor
1 parent 49c3a4e commit 212c4ef

File tree

3 files changed

+63
-75
lines changed

3 files changed

+63
-75
lines changed
Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import Button from "@material-ui/core/Button"
21
import { makeStyles } from "@material-ui/core/styles"
2+
import { Stack } from "components/Stack/Stack"
33
import { FC } from "react"
44
import * as TypesGen from "../../api/typesGenerated"
55
import { BaseIcon } from "./BaseIcon"
@@ -13,24 +13,29 @@ export const AppPreviewLink: FC<AppPreviewProps> = ({ app }) => {
1313
const styles = useStyles()
1414

1515
return (
16-
<Button
17-
size="small"
18-
startIcon={<BaseIcon app={app} />}
19-
endIcon={<ShareIcon app={app} />}
20-
className={styles.button}
16+
<Stack
17+
className={styles.appPreviewLink}
18+
alignItems="center"
19+
direction="row"
20+
spacing={1}
2121
>
22-
<span className={styles.appName}>{app.name}</span>
23-
</Button>
22+
<BaseIcon app={app} />
23+
{app.name}
24+
<ShareIcon app={app} />
25+
</Stack>
2426
)
2527
}
2628

2729
const useStyles = makeStyles((theme) => ({
28-
button: {
29-
whiteSpace: "nowrap",
30-
cursor: "default",
31-
},
30+
appPreviewLink: {
31+
padding: theme.spacing(0.25, 1.5),
32+
borderRadius: 9999,
33+
border: `1px solid ${theme.palette.divider}`,
34+
color: theme.palette.text.primary,
35+
background: theme.palette.background.paper,
3236

33-
appName: {
34-
marginRight: theme.spacing(1),
37+
"& img, & svg": {
38+
width: 14,
39+
},
3540
},
3641
}))

site/src/components/Resources/AgentRowPreview.tsx

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { makeStyles } from "@material-ui/core/styles"
22
import { AppPreviewLink } from "components/AppLink/AppPreviewLink"
33
import { FC } from "react"
4+
import { combineClasses } from "util/combineClasses"
45
import { WorkspaceAgent } from "../../api/typesGenerated"
56
import { Stack } from "../Stack/Stack"
67

@@ -23,22 +24,43 @@ export const AgentRowPreview: FC<AgentRowPreviewProps> = ({ agent }) => {
2324
<div className={styles.agentStatusWrapper}>
2425
<div className={styles.agentStatusPreview}></div>
2526
</div>
26-
<Stack alignItems="baseline" direction="row">
27-
<div className={styles.agentName}>{agent.name}</div>
28-
<span className={styles.agentOS}>{agent.operating_system}</span>
29-
</Stack>
30-
</Stack>
27+
<Stack
28+
alignItems="baseline"
29+
direction="row"
30+
spacing={4}
31+
className={styles.agentData}
32+
>
33+
<Stack direction="row" alignItems="baseline" spacing={1}>
34+
<span>Agent:</span>
35+
<span className={styles.agentDataValue}>{agent.name}</span>
36+
</Stack>
3137

32-
<Stack
33-
direction="row"
34-
alignItems="center"
35-
spacing={0.5}
36-
wrap="wrap"
37-
className={styles.appsColumn}
38-
>
39-
{agent.apps.map((app) => (
40-
<AppPreviewLink key={app.name} app={app} />
41-
))}
38+
<Stack direction="row" alignItems="baseline" spacing={1}>
39+
<span>OS:</span>
40+
<span
41+
className={combineClasses([
42+
styles.agentDataValue,
43+
styles.agentOS,
44+
])}
45+
>
46+
{agent.operating_system}
47+
</span>
48+
</Stack>
49+
50+
<Stack direction="row" alignItems="baseline" spacing={1}>
51+
<span>Apps:</span>
52+
<Stack
53+
direction="row"
54+
alignItems="center"
55+
spacing={0.5}
56+
wrap="wrap"
57+
>
58+
{agent.apps.map((app) => (
59+
<AppPreviewLink key={app.name} app={app} />
60+
))}
61+
</Stack>
62+
</Stack>
63+
</Stack>
4264
</Stack>
4365
</Stack>
4466
)
@@ -92,7 +114,12 @@ const useStyles = makeStyles((theme) => ({
92114
color: theme.palette.text.secondary,
93115
},
94116

95-
appsColumn: {
96-
minWidth: "50%",
117+
agentData: {
118+
fontSize: 14,
119+
color: theme.palette.text.secondary,
120+
},
121+
122+
agentDataValue: {
123+
color: theme.palette.text.primary,
97124
},
98125
}))

site/src/components/TemplateResourcesTable/TemplateResourcesTable.test.tsx

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)