Skip to content

Commit 851111b

Browse files
committed
Fix requested changes
1 parent db820ce commit 851111b

File tree

8 files changed

+20
-52
lines changed

8 files changed

+20
-52
lines changed

site/.storybook/preview.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { withThemes } from "@react-theming/storybook-addon"
44
import { createMemoryHistory } from "history"
55
import { addDecorator } from "node_modules/@storybook/react"
66
import { unstable_HistoryRouter as HistoryRouter } from "react-router-dom"
7-
import { dark, light } from "../src/theme"
7+
import { dark } from "../src/theme"
88
import "../src/theme/globalFonts"
99

1010
const providerFn = ({ children, theme }) => (
@@ -14,7 +14,7 @@ const providerFn = ({ children, theme }) => (
1414
</ThemeProvider>
1515
)
1616

17-
addDecorator(withThemes(null, [light, dark], { providerFn }))
17+
addDecorator(withThemes(null, [dark], { providerFn }))
1818

1919
const history = createMemoryHistory()
2020

site/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"typegen": "xstate typegen 'src/**/*.ts'"
2626
},
2727
"dependencies": {
28-
"@fontsource/ibm-plex-mono": "^4.5.9",
28+
"@fontsource/ibm-plex-mono": "4.5.9",
2929
"@fontsource/inter": "4.5.7",
3030
"@material-ui/core": "4.9.4",
3131
"@material-ui/icons": "4.5.1",
@@ -35,6 +35,7 @@
3535
"@xstate/react": "3.0.0",
3636
"axios": "0.26.1",
3737
"cronstrue": "2.4.0",
38+
"dayjs": "^1.11.2",
3839
"formik": "2.2.9",
3940
"history": "5.3.0",
4041
"react": "17.0.2",

site/src/components/ConfirmDialog/ConfirmDialog.test.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
import ThemeProvider from "@material-ui/styles/ThemeProvider"
21
import { fireEvent, render } from "@testing-library/react"
32
import React from "react"
43
import { act } from "react-dom/test-utils"
5-
import { dark } from "../../theme"
4+
import { WrapperComponent } from "../../testHelpers/renderHelpers"
65
import { ConfirmDialog, ConfirmDialogProps } from "./ConfirmDialog"
76

87
namespace Helpers {
98
export const Component: React.FC<ConfirmDialogProps> = (props: ConfirmDialogProps) => {
109
return (
11-
<ThemeProvider theme={dark}>
10+
<WrapperComponent>
1211
<ConfirmDialog {...props} />
13-
</ThemeProvider>
12+
</WrapperComponent>
1413
)
1514
}
1615
}

site/src/components/UserAvatar/UserAvatar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Avatar from "@material-ui/core/Avatar"
22
import { makeStyles } from "@material-ui/core/styles"
33
import React from "react"
4+
import { combineClasses } from "../../util/combineClasses"
45
import { firstLetter } from "../../util/firstLetter"
56

67
export interface UserAvatarProps {
@@ -11,7 +12,7 @@ export interface UserAvatarProps {
1112
export const UserAvatar: React.FC<UserAvatarProps> = ({ username, className }) => {
1213
const styles = useStyles()
1314
return (
14-
<Avatar variant="square" className={`${styles.avatar} ${className || ""}`}>
15+
<Avatar variant="square" className={combineClasses([styles.avatar, className])}>
1516
{firstLetter(username)}
1617
</Avatar>
1718
)

site/src/pages/WorkspacesPage/WorkspacesPage.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,18 @@ import TableRow from "@material-ui/core/TableRow"
99
import AddCircleOutline from "@material-ui/icons/AddCircleOutline"
1010
import useTheme from "@material-ui/styles/useTheme"
1111
import { useMachine } from "@xstate/react"
12+
import dayjs from "dayjs"
13+
import relativeTime from "dayjs/plugin/relativeTime"
1214
import React from "react"
1315
import { Link } from "react-router-dom"
1416
import { WorkspaceBuild } from "../../api/typesGenerated"
1517
import { Margins } from "../../components/Margins/Margins"
1618
import { Stack } from "../../components/Stack/Stack"
1719
import { firstLetter } from "../../util/firstLetter"
18-
import { getTimeSince } from "../../util/time"
1920
import { workspacesMachine } from "../../xServices/workspaces/workspacesXService"
2021

22+
dayjs.extend(relativeTime)
23+
2124
export const Language = {
2225
title: "Workspaces",
2326
}
@@ -67,7 +70,7 @@ export const WorkspacesPage: React.FC = () => {
6770
</TableCell>
6871
<TableCell>
6972
<span style={{ color: theme.palette.text.secondary }}>
70-
{getTimeSince(new Date(workspace.latest_build.created_at))} ago
73+
{dayjs().to(dayjs(workspace.latest_build.created_at))}
7174
</span>
7275
</TableCell>
7376
<TableCell>{getStatus(theme, workspace.latest_build)}</TableCell>

site/src/util/time.test.ts

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

site/src/util/time.ts

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

site/yarn.lock

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1269,7 +1269,7 @@
12691269
minimatch "^3.0.4"
12701270
strip-json-comments "^3.1.1"
12711271

1272-
"@fontsource/ibm-plex-mono@^4.5.9":
1272+
"@fontsource/ibm-plex-mono@4.5.9":
12731273
version "4.5.9"
12741274
resolved "https://registry.yarnpkg.com/@fontsource/ibm-plex-mono/-/ibm-plex-mono-4.5.9.tgz#96968bebc4b1ea559818a9c52c87b3854a8145ba"
12751275
integrity sha512-goblhmAX48GELIUQnWBg6AKVZklcTUu6NwF8tRiIzlxTZuOspbzHrW/3sF3WOH6+mJVay9n6QLbbikOfxSRekQ==
@@ -5783,6 +5783,11 @@ data-urls@^2.0.0:
57835783
whatwg-mimetype "^2.3.0"
57845784
whatwg-url "^8.0.0"
57855785

5786+
dayjs@^1.11.2:
5787+
version "1.11.2"
5788+
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.2.tgz#fa0f5223ef0d6724b3d8327134890cfe3d72fbe5"
5789+
integrity sha512-F4LXf1OeU9hrSYRPTTj/6FbO4HTjPKXvEIC1P2kcnFurViINCVk3ZV0xAS3XVx9MkMsXbbqlK6hjseaYbgKEHw==
5790+
57865791
debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.9:
57875792
version "2.6.9"
57885793
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"

0 commit comments

Comments
 (0)