Skip to content

refactor: Refactor last built by column #2968

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 13, 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
10 changes: 2 additions & 8 deletions site/src/components/AvatarData/AvatarData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ export const AvatarData: FC<AvatarDataProps> = ({ title, subtitle, link }) => {

return (
<div className={styles.root}>
<Avatar variant="square" className={styles.avatar}>
{firstLetter(title)}
</Avatar>
<Avatar className={styles.avatar}>{firstLetter(title)}</Avatar>

{link ? (
<Link
Expand All @@ -46,11 +44,7 @@ const useStyles = makeStyles((theme) => ({
alignItems: "center",
},
avatar: {
borderRadius: 2,
marginRight: theme.spacing(1),
width: 24,
height: 24,
fontSize: 16,
marginRight: theme.spacing(1.5),
},
info: {
display: "flex",
Expand Down
16 changes: 1 addition & 15 deletions site/src/components/UserAvatar/UserAvatar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import Avatar from "@material-ui/core/Avatar"
import { makeStyles } from "@material-ui/core/styles"
import { FC } from "react"
import { combineClasses } from "../../util/combineClasses"
import { firstLetter } from "../../util/firstLetter"

export interface UserAvatarProps {
Expand All @@ -10,17 +8,5 @@ export interface UserAvatarProps {
}

export const UserAvatar: FC<UserAvatarProps> = ({ username, className }) => {
const styles = useStyles()
return (
<Avatar variant="square" className={combineClasses([styles.avatar, className])}>
{firstLetter(username)}
</Avatar>
)
return <Avatar className={className}>{firstLetter(username)}</Avatar>
}

const useStyles = makeStyles((theme) => ({
avatar: {
borderRadius: 2,
border: `1px solid ${theme.palette.divider}`,
},
}))
19 changes: 11 additions & 8 deletions site/src/components/WorkspacesTable/WorkspacesRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ export const WorkspacesRow: FC<{ workspaceRef: WorkspaceItemMachineRef }> = ({ w
<TableCellLink to={workspacePageLink}>
<AvatarData title={workspace.name} subtitle={workspace.owner_name} />
</TableCellLink>
<TableCellLink to={workspacePageLink}>
<AvatarData
title={initiatedBy.initiatedBy}
subtitle={dayjs().to(dayjs(workspace.latest_build.created_at))}
/>
</TableCellLink>
<TableCellLink to={workspacePageLink}>{workspace.template_name}</TableCellLink>
<TableCellLink to={workspacePageLink}>
{workspace.outdated ? (
Expand All @@ -60,14 +66,7 @@ export const WorkspacesRow: FC<{ workspaceRef: WorkspaceItemMachineRef }> = ({ w
<span style={{ color: theme.palette.text.secondary }}>{Language.upToDateLabel}</span>
)}
</TableCellLink>
<TableCellLink to={workspacePageLink}>
<span data-chromatic="ignore" style={{ color: theme.palette.text.secondary }}>
{dayjs().to(dayjs(workspace.latest_build.created_at))}
</span>
</TableCellLink>
<TableCellLink to={workspacePageLink}>
<span style={{ color: initiatedBy.color }}>{initiatedBy.initiatedBy}</span>
</TableCellLink>

<TableCellLink to={workspacePageLink}>
<span style={{ color: status.color }}>{status.status}</span>
</TableCellLink>
Expand Down Expand Up @@ -108,4 +107,8 @@ const useStyles = makeStyles((theme) => ({
alignItems: "center",
gap: theme.spacing(0.5),
},
buildTime: {
color: theme.palette.text.secondary,
fontSize: 12,
},
}))
12 changes: 5 additions & 7 deletions site/src/components/WorkspacesTable/WorkspacesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ const Language = {
name: "Name",
template: "Template",
version: "Version",
lastBuilt: "Last Built",
status: "Status",
lastBuiltBy: "By",
lastBuiltBy: "Last Built By",
}

export interface WorkspacesTableProps {
Expand All @@ -27,11 +26,10 @@ export const WorkspacesTable: FC<WorkspacesTableProps> = ({ isLoading, workspace
<Table>
<TableHead>
<TableRow>
<TableCell width="30%">{Language.name}</TableCell>
<TableCell width="15%">{Language.template}</TableCell>
<TableCell width="10%">{Language.version}</TableCell>
<TableCell width="15%">{Language.lastBuilt}</TableCell>
<TableCell width="15%">{Language.lastBuiltBy}</TableCell>
<TableCell width="25%">{Language.name}</TableCell>
<TableCell width="20%">{Language.lastBuiltBy}</TableCell>
<TableCell width="20%">{Language.template}</TableCell>
<TableCell width="20%">{Language.version}</TableCell>
<TableCell width="15%">{Language.status}</TableCell>
<TableCell width="1%"></TableCell>
</TableRow>
Expand Down
8 changes: 4 additions & 4 deletions site/src/theme/overrides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ export const getOverrides = (palette: PaletteOptions) => {
return {
MuiAvatar: {
root: {
width: 32,
height: 32,
fontSize: 24,
border: `1px solid ${palette.divider}`,
borderColor: palette.divider,
width: 36,
height: 36,
fontSize: 20,
},
},
MuiButton: {
Expand Down