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

Masterbar: clean up, component refactor, and move to gridicons #631

Merged
merged 18 commits into from
Dec 21, 2015

Conversation

mtias
Copy link
Member

@mtias mtias commented Nov 24, 2015

This issue is a deep refactoring of the Masterbar component.

Summary:

  • Modular, normalized the components to just masterbar-item* and derivates.
  • Restructured the DOM tree from 7-levels to 2-levels.
  • Rewritten the SCSS almost entirely, using flex magic.
  • Switched to ES6 syntax.
  • Ready for logged-out / SSR masterbar work.
  • Switches to Gridicons.

To test:

  • Do a fresh load (cache off / cleared)
  • Navigate to the top five sections (My Sites, Reader, New, Me, Notifications)
  • Pay attention at the loader dot the first time each section loads, and see if there are glitches
  • Check that notifications work (orange bubble appearing and disappearing)
  • Check that all the above work on mobile.
  • If you have a single-site account, test everything works on that too.
  • Check all the browsers we support (Chrome, Safari, Firefox, Edge, IE), mobile ones too (Safari, Chrome)!

Please take extra care in testing this one since it's a very important piece of the navigation.


Original Text:

Old:
image

New (24px):
image

@artpi
Copy link
Contributor

artpi commented Nov 25, 2015

Looks good so far, works good also

@folletto
Copy link
Contributor

Tested on Chrome, Firefox, Safari.

The icon seems slightly lower than the text, fixed that, works. :)

screen shot 2015-11-27 at 12 56 25

@seear
Copy link
Contributor

seear commented Dec 7, 2015

Logged-out
Old:
screen shot 2015-12-07 at 18 27 42
New:
screen shot 2015-12-07 at 18 28 02

The WP gridicon is very slightly lower logged-out than logged-in for a reason that I cannot yet ascertain.

@folletto
Copy link
Contributor

folletto commented Dec 8, 2015

I've to wrap up for the day, but so far I think I managed to:

  1. Refactored the React components to use just one, MasterbarItem.
  2. Heavily restructured the DOM (from a 7-levels hierarchy to a 2-levels one).
  3. Cleared the CSS as a consequence, making it with flex.

Which sorted out automatically all the alignment issues.

screen shot 2015-12-08 at 18 19 10

screen shot 2015-12-08 at 18 24 11

Missing:

  • Hooking up SitesPopover.
  • Hooking up Notifications.
  • Cross-browser / device testing / debugging (I'm already aware of a couple of things: colors and avatar).
  • Testing in general (it's a very important component, so I'd double down).
  • Cleanup of the then unused code and components.

@rickybanister
Copy link

Yay for flex.

The spacing between things on the right side bothered me with the old layout, but it seems even worse with the new layout:

screen shot 2015-12-08 at 4 58 16 pm

I realize it's different if you hover, but it just looks wrong most of the time—any thoughts on what we might do?

@folletto
Copy link
Contributor

folletto commented Dec 8, 2015

Yeah as you noticed right now it's purely, mathematically, padded. We can do optical adjustment before merging once the core of this PR is done. The way the code is structured now should make it piece of cake. :)

@folletto
Copy link
Contributor

The SitesPopover is now hooked up in a new component MasterbarItemNew.

screen shot 2015-12-11 at 12 30 17

@folletto
Copy link
Contributor

First step in componentizing Notifications with MasterbarItemNotifications. Right now just toggles.

screen shot 2015-12-11 at 13 21 53

Missing:

  • Set active state when open
  • Show notification dot

@ehg ehg force-pushed the update/masterbar branch from d1f883e to a698d7c Compare December 14, 2015 18:52
@folletto
Copy link
Contributor

Tested on Chrome, Firefox, Safari, IE11, Edge. Works. 👍

With the changes above now the notification dot works, and the style issues across the browsers all work.

screen shot 2015-12-15 at 14 01 01

There are still two bugs:

  • On Firefox 42, the first click on the Notification icon doesn't open the panel. Further clicks do.
    Blocker.
  • When the Notification area is clicked, the other highlight doesn't turn off.
    Non-blocker.

And some style changes, as noted above:

  • Spacing between icons on the right.

@jasmussen
Copy link
Member

A couple of quick observations just tested in Chrome today at various viewport sizes:

1: New post button doesn't have white fill when active, like current masterbar has:

screen shot 2015-12-15 at 14 10 11

2: Loading "pulse dot" overlays "new post" button in responsive mode. Not actually sure if this is unique to the new masterbar or if this also affects the old:

screen shot 2015-12-15 at 14 11 58

3: In a viewport width that invoke the mobile breakpoint, I couldn't get notifications to work at all. The button would be blue indicating it was clicked, but nothing would happen:

screen shot 2015-12-15 at 14 12 09

I will test more later on, using devices and other browsers.

@folletto
Copy link
Contributor

Thanks!

1 — fixed, pushed a commit.
2 — it affects the old too, but since this is flexing it can be bigger than the cover. Reviewing...
3 — ach. definitely a blocker.

So, summary of outstanding issues so far for ease of reading:

  1. On mobile the Notification panel doesn't show.
    Blocker.
  2. On Firefox 42, the first click on the Notification icon doesn't open the panel. Further clicks do.
    Blocker.
  3. Loader dot covering doesn't cover enough.
    Blocker.
  4. When the Notification area is clicked, the other highlight doesn't turn off.
    Non-blocker.
  5. Spacing between icons on the right should be tightened.
    Non-blocker.

@folletto
Copy link
Contributor

(1) On mobile the Notification panel doesn't show.
Blocker.

Fixed.

(2) On Firefox 42, the first click on the Notification icon doesn't open the panel. Further clicks do.
Blocker.

I discovered this is a bug present in production too. Not a blocker anymore for this PR. Opened an issue for it on #1611.


getInitialState() {
let newNote = false;
let user;
Copy link
Contributor

Choose a reason for hiding this comment

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

Accidental tab here after let should be space.

@folletto
Copy link
Contributor

Found another bug: dot bubble is misaligned on mobile.

screen shot 2015-12-15 at 16 28 30

@folletto
Copy link
Contributor

(3) Loader dot covering doesn't cover enough.
Blocker.

Fixed.
Also made the background appear only on mobile sizes.

screen shot 2015-12-15 at 16 50 04

@mtias
Copy link
Member Author

mtias commented Dec 15, 2015

Looking nice!

@apeatling
Copy link
Member

Great updates so far. Still not convinced about the no-label usability impact on mobile (even though visually it looks better) but I'm not sure how we'd measure that.

Also -- I mentioned it in the previous issue -- this should not merge until the front end masterbar matches. Otherwise we run the risk of that being forgotten and having a huge lag.

@folletto
Copy link
Contributor

Great updates so far. Still not convinced about the no label usability impact on mobile (even though visually it looks better) but I'm not sure how we'd measure that.

That's mostly a byproduct of the cleanup code. I thought to leave that in and see if we need to add them back in. At this stage, I'd merge it like this and revert later if we think it's better. But open to discussion.

Also -- I mentioned it in the previous issue -- this should not merge until the front end masterbar matches. Otherwise we run the risk of that being forgotten and having a huge lag.

True. This however goes far far far beyond the change of icons. So I feel it's rather important we push this as soon as it's ready — whatever this means.

ehg and others added 8 commits December 21, 2015 17:23
Cleanup: named z-index lost in rebase
Identation fix
Remove dead imports
Fix: force correct icon color on Firefox and IE11.
Fix: active state on Editor
Fix: show Notification panel showing in mobile breakpoint.

Fix: spacing
Fix: layout loader.
Fix: align dot bubble position on mobile
Fix: better visual rhythm for rightmost icons.
Fix: active Notifications now disable other active states
remove masterbar-new-post

remove masterbar-logged-out-menu
`section` gets initially passed as `false`, then becomes a string.

Fix: hooked up Editor preload

Cleanup: null and 0 are equivalent for ">" operator.

Cleanup: made user "isRequired".

Cleanup: shorter unseen notes code

Fix whitespace

Cleanup: isActive

Cleanup: using ES6 default param

Fix: the bar (fixed) now doesn't scroll away on mobile

Fixes #1283
- Create "masterbar" folder.
- Move sub-components.
- Clean up layout folder.
- Consolidate styles in the component.

Remove old assets/stylesheet file for masterbar.
@ehg ehg force-pushed the update/masterbar branch from 813e083 to d84201f Compare December 21, 2015 17:25
@seear seear added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Dec 21, 2015
seear added a commit that referenced this pull request Dec 21, 2015
Masterbar: clean up, component refactor, and move to gridicons
@seear seear merged commit b2d9c21 into master Dec 21, 2015
@seear seear deleted the update/masterbar branch December 21, 2015 17:36
@aduth
Copy link
Contributor

aduth commented Dec 21, 2015

Was it intentional to not use the <SiteStatsStickyLink /> component for the My Sites link in the master bar? Now when I click My Sites, I'm always directed to the "All Sites" view. For reference, the code clearly links to the /stats base URL:

https://github.com/Automattic/wp-calypso/blob/d84201f/client/layout/masterbar/index.jsx#L69

@folletto
Copy link
Contributor

Yes and No :)

Yes: the masterbar was a hairball of very different components, each with different use and intent, so it has been normalized using all the same component.

No: that logic bit was missed since it didn't appear as a branching function on the URL logic, but stacked as component.

I'd re-add that at the masterbar level (which handles the logic), as a simple function.

@folletto
Copy link
Contributor

...or as you did in #1894 heh :)

@lancewillett
Copy link
Contributor

Looks like this change broke the n keyboard shortcut to open Notifications.

TypeError: Failed to execute 'contains' on 'Node': parameter 1 is not of type 'Node'. in Chrome console
client/layout/masterbar/notifications.jsx:67

Logged bug in #1907

@apeatling
Copy link
Member

@seear What's the plan to update the black front-end masterbar with the same changes? I was under the impression this would be pretty soon after, but I'm still seeing the labeled version.

@folletto
Copy link
Contributor

folletto commented Jan 4, 2016

It has been updated to Gridicons, the labels were kept mostly for ease of the first patch. We should align the labels off too now, with a follow-up patch on front-end.

@apeatling
Copy link
Member

👍

@seear
Copy link
Contributor

seear commented Jan 5, 2016

@apeatling: frontend masterbar is now updated to match Calypso label/breakpoint behaviour.

@apeatling
Copy link
Member

🎉

@folletto folletto self-assigned this Feb 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.