Skip to content

Commit 000bc50

Browse files
refactor: Refactor last built by column (#2968)
1 parent 0212933 commit 000bc50

File tree

5 files changed

+23
-42
lines changed

5 files changed

+23
-42
lines changed

site/src/components/AvatarData/AvatarData.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ export const AvatarData: FC<AvatarDataProps> = ({ title, subtitle, link }) => {
1717

1818
return (
1919
<div className={styles.root}>
20-
<Avatar variant="square" className={styles.avatar}>
21-
{firstLetter(title)}
22-
</Avatar>
20+
<Avatar className={styles.avatar}>{firstLetter(title)}</Avatar>
2321

2422
{link ? (
2523
<Link
@@ -46,11 +44,7 @@ const useStyles = makeStyles((theme) => ({
4644
alignItems: "center",
4745
},
4846
avatar: {
49-
borderRadius: 2,
50-
marginRight: theme.spacing(1),
51-
width: 24,
52-
height: 24,
53-
fontSize: 16,
47+
marginRight: theme.spacing(1.5),
5448
},
5549
info: {
5650
display: "flex",
Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import Avatar from "@material-ui/core/Avatar"
2-
import { makeStyles } from "@material-ui/core/styles"
32
import { FC } from "react"
4-
import { combineClasses } from "../../util/combineClasses"
53
import { firstLetter } from "../../util/firstLetter"
64

75
export interface UserAvatarProps {
@@ -10,17 +8,5 @@ export interface UserAvatarProps {
108
}
119

1210
export const UserAvatar: FC<UserAvatarProps> = ({ username, className }) => {
13-
const styles = useStyles()
14-
return (
15-
<Avatar variant="square" className={combineClasses([styles.avatar, className])}>
16-
{firstLetter(username)}
17-
</Avatar>
18-
)
11+
return <Avatar className={className}>{firstLetter(username)}</Avatar>
1912
}
20-
21-
const useStyles = makeStyles((theme) => ({
22-
avatar: {
23-
borderRadius: 2,
24-
border: `1px solid ${theme.palette.divider}`,
25-
},
26-
}))

site/src/components/WorkspacesTable/WorkspacesRow.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ export const WorkspacesRow: FC<{ workspaceRef: WorkspaceItemMachineRef }> = ({ w
4545
<TableCellLink to={workspacePageLink}>
4646
<AvatarData title={workspace.name} subtitle={workspace.owner_name} />
4747
</TableCellLink>
48+
<TableCellLink to={workspacePageLink}>
49+
<AvatarData
50+
title={initiatedBy.initiatedBy}
51+
subtitle={dayjs().to(dayjs(workspace.latest_build.created_at))}
52+
/>
53+
</TableCellLink>
4854
<TableCellLink to={workspacePageLink}>{workspace.template_name}</TableCellLink>
4955
<TableCellLink to={workspacePageLink}>
5056
{workspace.outdated ? (
@@ -60,14 +66,7 @@ export const WorkspacesRow: FC<{ workspaceRef: WorkspaceItemMachineRef }> = ({ w
6066
<span style={{ color: theme.palette.text.secondary }}>{Language.upToDateLabel}</span>
6167
)}
6268
</TableCellLink>
63-
<TableCellLink to={workspacePageLink}>
64-
<span data-chromatic="ignore" style={{ color: theme.palette.text.secondary }}>
65-
{dayjs().to(dayjs(workspace.latest_build.created_at))}
66-
</span>
67-
</TableCellLink>
68-
<TableCellLink to={workspacePageLink}>
69-
<span style={{ color: initiatedBy.color }}>{initiatedBy.initiatedBy}</span>
70-
</TableCellLink>
69+
7170
<TableCellLink to={workspacePageLink}>
7271
<span style={{ color: status.color }}>{status.status}</span>
7372
</TableCellLink>
@@ -108,4 +107,8 @@ const useStyles = makeStyles((theme) => ({
108107
alignItems: "center",
109108
gap: theme.spacing(0.5),
110109
},
110+
buildTime: {
111+
color: theme.palette.text.secondary,
112+
fontSize: 12,
113+
},
111114
}))

site/src/components/WorkspacesTable/WorkspacesTable.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ const Language = {
1111
name: "Name",
1212
template: "Template",
1313
version: "Version",
14-
lastBuilt: "Last Built",
1514
status: "Status",
16-
lastBuiltBy: "By",
15+
lastBuiltBy: "Last Built By",
1716
}
1817

1918
export interface WorkspacesTableProps {
@@ -27,11 +26,10 @@ export const WorkspacesTable: FC<WorkspacesTableProps> = ({ isLoading, workspace
2726
<Table>
2827
<TableHead>
2928
<TableRow>
30-
<TableCell width="30%">{Language.name}</TableCell>
31-
<TableCell width="15%">{Language.template}</TableCell>
32-
<TableCell width="10%">{Language.version}</TableCell>
33-
<TableCell width="15%">{Language.lastBuilt}</TableCell>
34-
<TableCell width="15%">{Language.lastBuiltBy}</TableCell>
29+
<TableCell width="25%">{Language.name}</TableCell>
30+
<TableCell width="20%">{Language.lastBuiltBy}</TableCell>
31+
<TableCell width="20%">{Language.template}</TableCell>
32+
<TableCell width="20%">{Language.version}</TableCell>
3533
<TableCell width="15%">{Language.status}</TableCell>
3634
<TableCell width="1%"></TableCell>
3735
</TableRow>

site/src/theme/overrides.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ export const getOverrides = (palette: PaletteOptions) => {
66
return {
77
MuiAvatar: {
88
root: {
9-
width: 32,
10-
height: 32,
11-
fontSize: 24,
12-
border: `1px solid ${palette.divider}`,
9+
borderColor: palette.divider,
10+
width: 36,
11+
height: 36,
12+
fontSize: 20,
1313
},
1414
},
1515
MuiButton: {

0 commit comments

Comments
 (0)