-
Notifications
You must be signed in to change notification settings - Fork 881
feat: Redesign workspaces page #1450
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
Conversation
The navbar was unnecessarily large before, which made the UI feel a bit bloaty from my perspective.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me so far! All the pages look great but I think something needs to be updated for the stories since they are all throwing errors.
content: `" "`, | ||
bottom: 0, | ||
left: theme.spacing(3), | ||
background: "#C16800", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a good theme color that could go here in place of the hardcoded color? Like secondary
or something maybe.
site/webpack.dev.ts
Outdated
@@ -61,8 +61,9 @@ const config: Configuration = { | |||
port: process.env.PORT || 8080, | |||
proxy: { | |||
"/api": { | |||
target: "http://localhost:3000", | |||
target: "https://dev.coder.com", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be an environment variable or something so we can still develop locally?
The theme provider for storybook needs to be set in coder/site/.storybook/preview.js Lines 7 to 17 in dbd5b4a
|
site/package.json
Outdated
@@ -25,7 +25,7 @@ | |||
"typegen": "xstate typegen 'src/**/*.ts'" | |||
}, | |||
"dependencies": { | |||
"@fontsource/fira-code": "4.5.9", | |||
"@fontsource/ibm-plex-mono": "^4.5.9", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Can you pin this dependency to 4.5.9
? You run the upgrade
command to do it:
cd site
yarn upgrade @fontsource/ibm-plex-mono@4.5.9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vapurrmaid I notice we have yarn.lock
- what's the thought process behind pinning dependencies?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll answer those two questions separately:
- Why do we want them pinned
vs
- Why pin in package.json
For the former: We have a RFC and guide covering, but the TL:DR is more incremental upgrades w depend-a-bot
For the latter: I don't know if having them unpinned interferes with depend-a-bot or any other tool, but simply for precision. I shouldn't have to hunt down the actual version in yarn.lock
to answer what version of X we're on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, will look at the guide!
<TableCell>Name</TableCell> | ||
<TableCell>Template</TableCell> | ||
<TableCell>Version</TableCell> | ||
<TableCell>Last Built</TableCell> | ||
<TableCell>Status</TableCell> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: All of these should be defined in Language
, including the <Button>
text above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where did the Language
convention come from? Have we thought about using react-i18next?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great question!
i18n was not implemented in v1, and will be an eventual need for v2. We haven't yet planned for when but we know it will be an effort that we will eventually take on. In the meantime, Language
is a simple way of using primitives to begin resourcing strings for what's next. The idea wasn't to commit to a framework or have to solve that problem, but ensure that we're organized and ready to for when we do.
As a bonus, we can share Language
in test like this:
coder/site/src/pages/LoginPage/LoginPage.test.tsx
Lines 21 to 27 in 26b04cc
it("renders the sign-in form", async () => { | |
// When | |
render(<LoginPage />) | |
// Then | |
await screen.findByText(Language.passwordSignIn) | |
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, make sense to me! Thanks for explaining.
Praise I really like the Status column, it's very nice 🎨 |
@kylecarbs I assigned this ticket #766 to you since this work looks to be related to it. |
I noticed we're keeping some overrides in |
@Kira-Pilot those are things I added specifically in this PR to adjust some stylistic things. |
site/src/util/time.ts
Outdated
@@ -0,0 +1,32 @@ | |||
export const getTimeSince = (date: Date): string => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use a library for this time stuff instead? I've used moment.js and day.js in the past
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, I implemented @vapurrmaid's suggestion of using day.js
!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made this suggestion above: #1450 (comment) which is prior art from v1. I'm quite happy with dayjs from that experience, and I know it's a small library.
@kylecarbs I am having a hard time running this locally using |
Yup! The create workspace page is included in #801 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the default look of the field input labels. The dialogs looked a bit better before IMO but definitely still usable (I like the reset password dialog though).
The margins component might need a background color removed or something, right now it has white text on a gray background https://www.chromatic.com/test?appId=624de63c6aacee003aa84340&id=62828332ad84ca004a3e0e03
Very handy we can see all the different workspace states in Chromatic!
Edit: this one seemed a bit strange to me as well, is that a disabled button? https://www.chromatic.com/test?appId=624de63c6aacee003aa84340&id=62828332ad84ca004a3e0ded
Not sure if this matters but should this be white? https://www.chromatic.com/test?appId=624de63c6aacee003aa84340&id=62828332ad84ca004a3e0dfd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One quick question I thought I'd submit review for right away since it's simple.
Following up with other items shortly.
@@ -1,20 +1,17 @@ | |||
import CssBaseline from "@material-ui/core/CssBaseline" | |||
import ThemeProvider from "@material-ui/styles/ThemeProvider" | |||
import { withThemes } from "@react-theming/storybook-addon" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question(if-minor): Are we able to remove this dependency now "@react-theming/storybook-addon": "1.1.5",
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch.
|
||
export const Language = { | ||
createButton: "Create Workspace", | ||
emptyView: "so you can check out your repositories, edit your source code, and build and test your software.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@code-asher all have been fixed! That weird button is actually a loading button, and looked weird before! |
@@ -9,7 +9,7 @@ export default { | |||
|
|||
const Template: Story = (args) => ( | |||
<Margins {...args}> | |||
<div style={{ width: "100%", background: "lightgrey" }}>Here is some content that will not get too wide!</div> | |||
<div style={{ width: "100%" }}>Here is some content that will not get too wide!</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still needs a background color - it proves that the margins are working
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh good catch! I'll make it black.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
import { WorkspacesPageView } from "./WorkspacesPageView" | ||
|
||
const WorkspacesPage: React.FC = () => { | ||
const [workspacesState] = useMachine(workspacesMachine) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reminds me that now that I'm doing a bunch of polling on the workspace page, I can and should useMachine
for that too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh interesting. I never thought of that, but I suppose it makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I have a couple important but small comments about the status bar and then some stylistic things you can decide on
Thank you for the reviews everyone 🥳🥳🥳🥳🥳 @vapurrmaid I see you're pending on UI for Storybook. I'm going to merge this in, but I'm extremely happy to make any changes post! |
* feat: Improve navbar to be more compact The navbar was unnecessarily large before, which made the UI feel a bit bloaty from my perspective. * Attempt to remove overrides * Update theme * Add text field * Update theme to dark! * Fix import ordering * Fix page location * Fix requested changes * Add storybook for workspaces page view * Add empty view * Add tests for empty view * Remove templates page * Fix local port * Remove templates from nav * Fix e2e test * Remove time.ts * Remove dep * Add background color to margins * Merge status checking from workspace page * Fix requested changes * Fix workspace status tests
As part of redesigning the workspaces page, I updated the theme to dark mode and removed overrides resolving #1449. There's a lot of work that can be done here to improve, but this is a good start!
I've checked all pages to ensure nothing is bugged/broken, and it all looks good!
A text input will be added in the future to allow for filtering. This will work similarly to GitHub's issue filters:
owner:kylecarbs
,status:running
,is:outdated
, etc.I proposed initially that workspaces be nested under templates, but that provided a restrictive view for admins. Admins and managers should get a full view of their Coder deployment from the workspaces page, which they now can!
Todo
Maybe pagination? Might do that in another PR