Skip to content
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

[feat] Add new themes #85

Merged
merged 17 commits into from
Nov 6, 2023
Merged

[feat] Add new themes #85

merged 17 commits into from
Nov 6, 2023

Conversation

2Steaks
Copy link
Collaborator

@2Steaks 2Steaks commented Oct 24, 2023

What?

This PR adds a rewrite of the UI for the ui package

Why?

We wanted to update the UIs & UX so that they feel more aligned to the k6 product.

Dark Mode

Screenshot 2023-10-23 at 16 49 43 Screenshot 2023-10-23 at 16 49 58 Screenshot 2023-10-23 at 16 50 18

Light Mode

Screenshot 2023-10-23 at 16 49 32 Screenshot 2023-10-23 at 16 50 04 Screenshot 2023-10-23 at 16 50 11

How to test?

  • move to /dashboard/assets/packages/ui
  • run yarn && yarn dev
  • open browser at suggested port
  • open another terminal in root of project
  • run go run mage.go run script.js
  • see the magic happen

Notes

@szkiba given how dynamic your framework is, would it be possible to add a one-off component for displaying a summary of stats (see screenshot of design) or does that break the model?

Screenshot 2023-10-24 at 11 50 40

Checklist

  • I have performed a self-review of my code.
  • I have added tests for my changes.
  • I have run linter locally (go run mage.go lint) and all checks pass.
  • I have run tests locally (go run mage.go test) and all tests pass.
  • I have commented on my code, particularly in hard-to-understand areas.

- Update styles
- Add new components
- Add package react-popper (2.2kb gzip)
@2Steaks 2Steaks self-assigned this Oct 24, 2023
# Conflicts:
#	dashboard/assets/packages/ui/dist/assets/index-2172ee12.js
#	dashboard/assets/packages/ui/dist/index.html
if (options.axes.length > 2) {
options.axes[2].side = 1
}
const options = createOptions({ plot, theme, width })

function onCreate(chart: uPlot) {
Copy link
Collaborator Author

@2Steaks 2Steaks Oct 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@szkiba is this function still required? I'm yet to see it being used.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is about to set second vertical axe to right side... if any

Copy link

@ckbedwell ckbedwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big improvement and looks nice!

Predictably, you can guess what my comments are going to be about as I review all PRs using just my keyboard and screen reader 😬

Two other nits:

390px has a nice layout but once I go beneath that (or have browser zoom enabled), it reverts to multiple columns:

Screenshot of xk6 browser at 389px resolution. The layout has reverted back to its full screen layout.

At certain resolutions the card metrics have uneven heights due to the titles wrapping to two lines. I think with a little bit of flex magic these could line up nicely still.

Screenshot of xk6 browser core metric cards. At this screen resolution the cards are uneven in height.


useEventListener("mouseup", handleClickAway, documentRef)

return <>{cloneElement(children, { ref: handleRef })}</>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a keyboard listener event to this as well so if you tab into or out of it it knows to close it? (And also 'esc' closes it 😄 ).

dashboard/assets/packages/ui/src/components/Icon/Icon.tsx Outdated Show resolved Hide resolved

return (
<>
<IconButton ref={setReferenceElement} name="options" variant="text" onClick={() => setIsOpen(!isOpen)} />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aria-label="Menu" here.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this some thought and I also think it should have aria-expanded={isOpen ? 'true' : ' false}.

dashboard/assets/packages/ui/src/components/Nav/Nav.tsx Outdated Show resolved Hide resolved
dashboard/assets/packages/ui/src/components/Nav/Nav.tsx Outdated Show resolved Hide resolved
Comment on lines 37 to 42
active: [
itemBase,
{
color: vars.colors.text.primary
}
],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In both light and dark modes I can barely see the active states. I think these could be improved so they are easier to identify.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you might have missed re-looking at this one 😃

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I'd updated the theme and thought there was quite a strong difference now :/

Screen.Recording.2023-11-03.at.13.37.19.mov

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot of xk6 dashboard on the timings page in Dark mode.

Screenshot of xk6 dashboard on the timings page in Light mode.

It does match what you are showing there, I'm mostly finding the active and inactive states really similar. At a glance I can't differentiate between them without really concentrating. Could do something similar to what the Grafana tabs do with the underlines?

Screenshot of Grafana Cloud k6 test run page in Light mode, focussing on the tabs UI.

Screenshot of Grafana Cloud k6 test run page in Dark mode, focussing on the tabs UI.

Copy link
Collaborator Author

@2Steaks 2Steaks Nov 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having a line conflicts with the loading bar, how about a background?

Screenshot 2023-11-06 at 11 20 31 Screenshot 2023-11-06 at 11 14 04

Copy link

@ckbedwell ckbedwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few last comments! I missed a bit of cleanup from last time removing some of the redundant aria attributes and roles and gave a bit more thought to the menu.

I think you missed updating the active and hover states for the menu 😃

<ClickAwayListener onClickAway={() => setIsOpen(false)}>
<Paper
{...attributes.popper}
aria-label="Menu"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, wrong place. This wants to be on the IconButton above rather than on the Paper component.

))}
</main>
</div>
<Flex direction="column" gap={3} role="tabpanel" id={`tabpanel-${idx}`} aria-labelledby={`tab-${idx}`}>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I missed these the first time round. You can drop the role, id and aria-labelledby attributes here, they aren't hooked up correctly and I think in the context of this app they aren't really tabs.

Comment on lines 37 to 42
active: [
itemBase,
{
color: vars.colors.text.primary
}
],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you might have missed re-looking at this one 😃

{options.map((option, index) => (
<Item
key={option.id}
aria-controls={`nav-${index}`}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can remove the aria-controls here as it isn't hooked up correctly and as said for the tab panel, I think isn't the right tool to use in this context.


return (
<>
<IconButton ref={setReferenceElement} name="options" variant="text" onClick={() => setIsOpen(!isOpen)} />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this some thought and I also think it should have aria-expanded={isOpen ? 'true' : ' false}.

Copy link

@ckbedwell ckbedwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome job, looks great! 💪

@2Steaks 2Steaks merged commit 4a2e03f into master Nov 6, 2023
10 checks passed
@szkiba szkiba deleted the feat/ui-theme branch June 7, 2024 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants