Skip to content

refactor: Make the workspace panels more light #2984

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 2 commits into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
13 changes: 5 additions & 8 deletions site/src/components/Resources/Resources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { TableHeaderRow } from "../TableHeaders/TableHeaders"
import { TerminalLink } from "../TerminalLink/TerminalLink"
import { AgentHelpTooltip } from "../Tooltips/AgentHelpTooltip"
import { ResourcesHelpTooltip } from "../Tooltips/ResourcesHelpTooltip"
import { WorkspaceSection } from "../WorkspaceSection/WorkspaceSection"

const Language = {
resources: "Resources",
Expand All @@ -41,10 +40,7 @@ export const Resources: FC<ResourcesProps> = ({
const theme: Theme = useTheme()

return (
<WorkspaceSection
title={Language.resources}
contentsProps={{ className: styles.sectionContents }}
>
<div aria-label={Language.resources} className={styles.wrapper}>
{getResourcesError ? (
{ getResourcesError }
) : (
Expand Down Expand Up @@ -137,13 +133,14 @@ export const Resources: FC<ResourcesProps> = ({
</TableBody>
</Table>
)}
</WorkspaceSection>
</div>
)
}

const useStyles = makeStyles((theme) => ({
sectionContents: {
margin: 0,
wrapper: {
borderRadius: theme.shape.borderRadius,
border: `1px solid ${theme.palette.divider}`,
},

table: {
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/Workspace/Workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const Workspace: FC<WorkspaceProps> = ({
/>
)}

<WorkspaceSection title="Timeline" contentsProps={{ className: styles.timelineContents }}>
<WorkspaceSection title="Logs" contentsProps={{ className: styles.timelineContents }}>
<BuildsTable builds={builds} className={styles.timelineTable} />
</WorkspaceSection>
</Stack>
Expand Down
17 changes: 6 additions & 11 deletions site/src/components/WorkspaceSection/WorkspaceSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ export const WorkspaceSection: React.FC<WorkspaceSectionProps> = ({
return (
<Paper className={styles.root} elevation={0}>
{title && (
<div className={styles.headerContainer}>
<div className={styles.header}>
<Typography variant="h6">{title}</Typography>
{action && <div>{action}</div>}
</div>
<div className={styles.header}>
<Typography variant="h6">{title}</Typography>
{action && <div>{action}</div>}
</div>
)}

Expand All @@ -48,19 +46,16 @@ const useStyles = makeStyles((theme) => ({
border: `1px solid ${theme.palette.divider}`,
borderRadius: CardRadius,
},
headerContainer: {
borderBottom: `1px solid ${theme.palette.divider}`,
},
contents: {
margin: theme.spacing(2),
},
header: {
alignItems: "center",
display: "flex",
justifyContent: "space-between",
marginBottom: theme.spacing(1),
marginTop: theme.spacing(1),
paddingLeft: CardPadding + theme.spacing(1),
paddingBottom: theme.spacing(1.5),
paddingTop: theme.spacing(2),
paddingLeft: CardPadding + theme.spacing(1.5),
paddingRight: CardPadding / 2,
},
}))
10 changes: 5 additions & 5 deletions site/src/components/WorkspaceStats/WorkspaceStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import dayjs from "dayjs"
import { FC } from "react"
import { Link as RouterLink } from "react-router-dom"
import { Workspace } from "../../api/typesGenerated"
import { CardRadius, MONOSPACE_FONT_FAMILY } from "../../theme/constants"
import { MONOSPACE_FONT_FAMILY } from "../../theme/constants"
import { combineClasses } from "../../util/combineClasses"
import { getDisplayStatus, getDisplayWorkspaceBuildInitiatedBy } from "../../util/workspace"
import { WorkspaceSection } from "../WorkspaceSection/WorkspaceSection"

const Language = {
workspaceDetails: "Workspace Details",
Expand All @@ -31,7 +30,7 @@ export const WorkspaceStats: FC<WorkspaceStatsProps> = ({ workspace }) => {
const initiatedBy = getDisplayWorkspaceBuildInitiatedBy(workspace.latest_build)

return (
<WorkspaceSection title={Language.workspaceDetails} contentsProps={{ className: styles.stats }}>
<div className={styles.stats} aria-label={Language.workspaceDetails}>
<div className={styles.statItem}>
<span className={styles.statsLabel}>{Language.templateLabel}</span>
<Link
Expand Down Expand Up @@ -74,7 +73,7 @@ export const WorkspaceStats: FC<WorkspaceStatsProps> = ({ workspace }) => {
</span>
</span>
</div>
</WorkspaceSection>
</div>
)
}

Expand All @@ -83,7 +82,8 @@ const useStyles = makeStyles((theme) => ({
paddingLeft: theme.spacing(2),
paddingRight: theme.spacing(2),
backgroundColor: theme.palette.background.paper,
borderRadius: CardRadius,
borderRadius: theme.shape.borderRadius,
border: `1px solid ${theme.palette.divider}`,
display: "flex",
alignItems: "center",
color: theme.palette.text.secondary,
Expand Down