Skip to content

refactor: Refactor template resources #4789

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor
  • Loading branch information
BrunoQuaresma committed Oct 27, 2022
commit 212c4efed668828de29a144dd6ab234e88959dda
33 changes: 19 additions & 14 deletions site/src/components/AppLink/AppPreviewLink.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Button from "@material-ui/core/Button"
import { makeStyles } from "@material-ui/core/styles"
import { Stack } from "components/Stack/Stack"
import { FC } from "react"
import * as TypesGen from "../../api/typesGenerated"
import { BaseIcon } from "./BaseIcon"
Expand All @@ -13,24 +13,29 @@ export const AppPreviewLink: FC<AppPreviewProps> = ({ app }) => {
const styles = useStyles()

return (
<Button
size="small"
startIcon={<BaseIcon app={app} />}
endIcon={<ShareIcon app={app} />}
className={styles.button}
<Stack
className={styles.appPreviewLink}
alignItems="center"
direction="row"
spacing={1}
>
<span className={styles.appName}>{app.name}</span>
</Button>
<BaseIcon app={app} />
{app.name}
<ShareIcon app={app} />
</Stack>
)
}

const useStyles = makeStyles((theme) => ({
button: {
whiteSpace: "nowrap",
cursor: "default",
},
appPreviewLink: {
padding: theme.spacing(0.25, 1.5),
borderRadius: 9999,
border: `1px solid ${theme.palette.divider}`,
color: theme.palette.text.primary,
background: theme.palette.background.paper,

appName: {
marginRight: theme.spacing(1),
"& img, & svg": {
width: 14,
},
},
}))
61 changes: 44 additions & 17 deletions site/src/components/Resources/AgentRowPreview.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { makeStyles } from "@material-ui/core/styles"
import { AppPreviewLink } from "components/AppLink/AppPreviewLink"
import { FC } from "react"
import { combineClasses } from "util/combineClasses"
import { WorkspaceAgent } from "../../api/typesGenerated"
import { Stack } from "../Stack/Stack"

Expand All @@ -23,22 +24,43 @@ export const AgentRowPreview: FC<AgentRowPreviewProps> = ({ agent }) => {
<div className={styles.agentStatusWrapper}>
<div className={styles.agentStatusPreview}></div>
</div>
<Stack alignItems="baseline" direction="row">
<div className={styles.agentName}>{agent.name}</div>
<span className={styles.agentOS}>{agent.operating_system}</span>
</Stack>
</Stack>
<Stack
alignItems="baseline"
direction="row"
spacing={4}
className={styles.agentData}
>
<Stack direction="row" alignItems="baseline" spacing={1}>
<span>Agent:</span>
<span className={styles.agentDataValue}>{agent.name}</span>
</Stack>

<Stack
direction="row"
alignItems="center"
spacing={0.5}
wrap="wrap"
className={styles.appsColumn}
>
{agent.apps.map((app) => (
<AppPreviewLink key={app.name} app={app} />
))}
<Stack direction="row" alignItems="baseline" spacing={1}>
<span>OS:</span>
<span
className={combineClasses([
styles.agentDataValue,
styles.agentOS,
])}
>
{agent.operating_system}
</span>
</Stack>

<Stack direction="row" alignItems="baseline" spacing={1}>
<span>Apps:</span>
<Stack
direction="row"
alignItems="center"
spacing={0.5}
wrap="wrap"
>
{agent.apps.map((app) => (
<AppPreviewLink key={app.name} app={app} />
))}
</Stack>
</Stack>
</Stack>
</Stack>
</Stack>
)
Expand Down Expand Up @@ -92,7 +114,12 @@ const useStyles = makeStyles((theme) => ({
color: theme.palette.text.secondary,
},

appsColumn: {
minWidth: "50%",
agentData: {
fontSize: 14,
color: theme.palette.text.secondary,
},

agentDataValue: {
color: theme.palette.text.primary,
},
}))

This file was deleted.