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

App Header React migration #4245

Merged
merged 36 commits into from
Oct 19, 2019
Merged

App Header React migration #4245

merged 36 commits into from
Oct 19, 2019

Conversation

ranbena
Copy link
Contributor

@ranbena ranbena commented Oct 15, 2019

  • Refactor

TODO

  • React migration
  • Responsive layout
  • Mobile layout - now with fixed position and better UX
  • All tests pass

Screen Shot 2019-10-16 at 21 49 03

Changes

  1. No faves

Screen Shot 2019-10-15 at 9 32 44

  1. Favorite lazy loading update

  1. Create button options (added "New" text)

Screen Shot 2019-10-15 at 9 56 58

Manually tested

  • Firefox, Safari, Chrome on Mac
  • Different viewport widths
  • Verified redundancy of deleted files
  • Verified permission defined rendering
  • Verified update available state

@ranbena ranbena self-assigned this Oct 15, 2019
@ranbena
Copy link
Contributor Author

ranbena commented Oct 15, 2019

Thanks to @gabrieldutra realized that the mobile version is crappy.
Updated a very simple fixed position header with minimal dropdown menu.

Screen Shot 2019-10-15 at 17 38 02

@arikfr
Copy link
Member

arikfr commented Oct 15, 2019

Quick things I noticed:

  1. The on-hover background color of menu items is hardly visible on my monitor.
  2. When clicking on queries/dashboards in some cases it both navigates and open the dropdown menu. In the current version there is a clear distinction between the hit area for the dropdown and for the link.
  3. In the current version when a menu open, the arrow points upwards.

Copy link
Member

@gabrieldutra gabrieldutra left a comment

Choose a reason for hiding this comment

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

I haven't tested the whole thing yet, but from my experience so far I can tell that mobile experience is a lot better 😁:

  • Navigation is much simpler (no more sub-sub-menus)
  • Now it closes the dropdown when you select an option
  • It's got position: fixed, so it's easily accessible from anywhere in page

For the desktop version I liked the blue bottom border and wdyt of having a black text color instead? (That gray feels de-emphasized to me)

</Dropdown>
</div>
<div className="header-logo">
<a href={clientConfig.basePath}>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<a href={clientConfig.basePath}>
<a href="./">

It annoys me that this depends on a backend config and it doesn't fit our Redash-preview case, for example... I wonder if the above works for Multi-org 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That actually works for multi-org!
Learned sth new today :)

fetch().$promise.then(({ results }) => {
setLoading(false);
setItems(results);
});
Copy link
Member

Choose a reason for hiding this comment

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

It worths using .finally(() => setLoading(false)), to avoid breaking in this case:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very true. Fixed!

@ranbena
Copy link
Contributor Author

ranbena commented Oct 15, 2019

10x @arikfr

  1. The on-hover background color of menu items is hardly visible on my monitor.

(It's the default ant-design dropdown menu color that we have across the site)
I strengthened it now - lmk if suitable.

  1. When clicking on queries/dashboards in some cases it both navigates and open the dropdown menu. In the current version there is a clear distinction between the hit area for the dropdown and for the link.

I had to do some cunning css to recreate the way it is in the current version.
Now made it more accurate - lmk if it still happens.

  1. In the current version when a menu open, the arrow points upwards.

Personally, I don't see the point in it.
But recreated it now. Check it out.

@ranbena
Copy link
Contributor Author

ranbena commented Oct 15, 2019

For the desktop version I liked the blue bottom border and wdyt of having a black text color instead? (That gray feels de-emphasized to me)

@gabrieldutra I was waiting for @arikfr to say sth about it 😄
I kinda like the gray as it doesn't take the focus from the actual app content, but let's agree on #​333? 4508544

{currentUser.isAdmin && (
<Menu.Item key="settings">
<a href="data_sources" className="menu-item-button">
<i className="fa fa-sliders" />
Copy link
Member

Choose a reason for hiding this comment

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

Considering the Help Trigger has a Tooltip on its own, wdyt about adding a Tooltip here as well? So will be a "standard" Icon Button behavior

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Also converted it to <Button> so it has the cool click animation.

@gabrieldutra
Copy link
Member

I kinda like the gray as it doesn't take the focus from the actual app content, but let's agree on #​333?

It does look like something Arik would say 😂. I prefer black, but #333333 doesn't bother me.

Copy link
Member

@arikfr arikfr left a comment

Choose a reason for hiding this comment

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

Looks good 👍

  1. I agree about the color of the text. While the idea of making it take less focus is valid it still looked pale.
  2. We might want to add some caching to favorites, so it doesn't fetch on every click.

@arikfr
Copy link
Member

arikfr commented Oct 16, 2019

Can do caching but what would cache bust? (assuming time based is a bad idea)

Why? Some short time span (1 minute?) will help with making sure that repeated clicks on the menu don't require new data.

@ranbena
Copy link
Contributor Author

ranbena commented Oct 16, 2019

Why? Some short time span (1 minute?) will help with making sure that repeated clicks on the menu don't require new data.

Cuz if a user adds or removes faves, the fave menu would be out of date until a minute has passed. I think that's no good.
Is the concern perf optimization? The UX is such that the fave list loads immediately and updates on server response (it's not optimal but it works).

@arikfr
Copy link
Member

arikfr commented Oct 16, 2019

Is the concern perf optimization?

Of course. I didn't look too much into it, but in a single check I saw that one of the favs endpoint returned results in 300ms and the other in 700ms. This feels borderline acceptable, no? Specially for repeated presses.

The other option is a Favorties "service" class, that holds current state and has a simple method of reset which clears the cache. This can be called by the Favorites control where we currently invoke the event.

@ranbena
Copy link
Contributor Author

ranbena commented Oct 16, 2019

Of course. I didn't look too much into it, but in a single check I saw that one of the favs endpoint returned results in 300ms and the other in 700ms. This feels borderline acceptable, no? Specially for repeated presses.

Borderline acceptable how? The user wait time is 0 on repeated presses.

The other option is a Favorties "service" class, that holds current state and has a simple method of reset which clears the cache. This can be called by the Favorites control where we currently invoke the event.

Sure sounds good. Ok to implement this in a subsequent PR? (Don't want the PR to balloon 🎈)

@ranbena
Copy link
Contributor Author

ranbena commented Oct 16, 2019

Correction - there IS a wait, but only when there're no faves in the list.

@ranbena ranbena marked this pull request as ready for review October 16, 2019 18:51
@arikfr
Copy link
Member

arikfr commented Oct 16, 2019

Correction - there IS a wait, but only when there're no faves in the list.

Why?

If the values are memoized, then it's fine to leave as is.

@ranbena
Copy link
Contributor Author

ranbena commented Oct 16, 2019

Why?

You're right I changed it now.

If the values are memoized, then it's fine to leave as is.

👍

@ranbena ranbena changed the title [WIP] AppHeader React Migration App Header React migration Oct 16, 2019
@ranbena ranbena dismissed arikfr’s stale review October 16, 2019 19:35

Attended to comments

$route.reload();
}

function Desktop() {
Copy link
Member

@gabrieldutra gabrieldutra Oct 16, 2019

Choose a reason for hiding this comment

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

Although implicit (and it's not a blocker for this) I would prefer naming those DesktopHeader and MobileHeader (or Navbar 🙂).

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1 for this 🙂

client/app/components/app-header/AppHeader.jsx Outdated Show resolved Hide resolved
Copy link
Member

@gabrieldutra gabrieldutra left a comment

Choose a reason for hiding this comment

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

Looking forward to share to my friends such improvements in Mobile UX :)

Code looks great and I didn't find any issues in UI. Only thing is the favorites loading that is a bit annoying, which will be fixed soon. I left one last comment.

Thanks, Ran! 🎉

Copy link
Collaborator

@kravets-levko kravets-levko left a comment

Choose a reason for hiding this comment

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

New header looks even better than previous one (especially on mobile) 🎉

Few comments, no blockers at all (up to you to accept them or not 👍)

client/app/components/app-header/AppHeader.jsx Outdated Show resolved Hide resolved
$route.reload();
}

function Desktop() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

+1 for this 🙂

@kravets-levko
Copy link
Collaborator

Linter crashes for a some reason 🤔

@ranbena ranbena merged commit a2e21dd into master Oct 19, 2019
@ranbena ranbena deleted the app-header branch October 19, 2019 11:26
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.

4 participants