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

Reader sidebar: toggle visibility of lists and tags #724

Merged
merged 9 commits into from
Feb 2, 2016

Conversation

bluefuton
Copy link
Contributor

Rather than showing all of the user's lists and tags in the sidebar, this PR experiments with hiding them behind a toggle.

Default state:

screen shot 2015-11-25 at 11 31 17

Expanded:

screen shot 2015-11-25 at 11 31 27

cc @shaunandrews

@bluefuton
Copy link
Contributor Author

As a starting point, I think I'd create a common component called something like SidebarFoldableSection (perhaps based on FoldableCard) which handles the open/close state and can be used for both tags and lists.

@bluefuton bluefuton force-pushed the add/sidebar-section-toggle branch from b4a75c0 to e617ccb Compare November 30, 2015 01:49
@bluefuton
Copy link
Contributor Author

Hey @shaunandrews - in e617ccb I added a new SidebarMenu component that manages its own open/closed state, just like FoldableCard does.

That means we don't need to keep track of the open state in the sidebar itself, which should clean things up a bit. We can also use the same component to render the lists and tags menus, which should reduce duplication of logic.

The new component doesn't include the 'add new list/tag' input yet, so that'd be the next step :)

(Sidenote: I had to rebase the branch and force push to get the dependencies working, so it's worth doing a git fetch && git reset --hard origin/add/sidebar-section-toggle to grab my changes.)

@shaunandrews
Copy link
Contributor

Awesome, @bluefuton. I've brought over the add button and input and things seem to mostly work for Lists, but adding a Tag is broken. Removing a tag is broken — not sure how to fix that. We also need to find a way to remember the state of the toggles for users.

@bluefuton bluefuton force-pushed the add/sidebar-section-toggle branch from d2d8680 to 0452fb2 Compare December 2, 2015 20:48
@bluefuton
Copy link
Contributor Author

Ah - I think the tags were failing because of

React.findDOMNode( this.refs.menuAddInput ).value = '';

That input is now in the MenuSidebar component, so it's not in ReaderSidebar's refs any more.

This wasn't tripping up lists because we were doing a redirect to Atlas before the line above got executed :)

I've added it to the SidebarMenu component now and it seems to be working well.

@bluefuton
Copy link
Contributor Author

We also need to find a way to remember the state of the toggles for users.

Yep. If we want to remember it, we should store it in the state of the parent component, ReaderSidebar.

@shaunandrews shaunandrews force-pushed the add/sidebar-section-toggle branch from 9368db8 to c755c81 Compare January 11, 2016 04:21
@shaunandrews
Copy link
Contributor

@bluefuton I rebased this and somewhere along the way I broke the add stuff again. Mind taking another look?

@bluefuton
Copy link
Contributor Author

@shaunandrews Absolutely, I'll take a look. There have been a few sidebar changes happening as part of List Management, so one of those is probably the culprit...

@ralder
Copy link
Contributor

ralder commented Jan 11, 2016

There are few issues what i found inside 'menu.jsx':

  • in function handleAddKeyDown missed input parameter event
  • also in this function not handled case if value of text input is empty and i press enter
  • since React 0.14 not need using findDOMNode
  • also will be good if when i press Add button text input get focus
  • for placeholder and button title need use translate

@bluefuton bluefuton force-pushed the add/sidebar-section-toggle branch from c755c81 to 19629f7 Compare January 11, 2016 21:23
@bluefuton
Copy link
Contributor Author

Thanks for the feedback @ralder!

I've addressed your points in 19629f7. And as a result the add input is now working again, @shaunandrews :)

@bluefuton
Copy link
Contributor Author

Todo:

  • persist open and closed state between page views
  • start using Sidebar components (see Framework: add <Sidebar> component under Layout #2272)
  • Re-fix multiple highlight bug (regression)
  • Split off separate components for tags, lists and teams
  • Fix highlight state for tags, lists and teams

@bluefuton
Copy link
Contributor Author

Big changes to the sidebar in #2272 made for a very tricky rebase 😑 All sorted now though.

@bluefuton bluefuton assigned bluefuton and unassigned shaunandrews Jan 18, 2016
@bluefuton bluefuton added this to the Reader: List Management milestone Jan 18, 2016
@bluefuton
Copy link
Contributor Author

Well, this turned into quite the 👹

...but includes a long overdue refactoring of the sidebar, and the first sprinkling of Redux in the Reader.

@bluefuton bluefuton added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Jan 19, 2016
@bluefuton
Copy link
Contributor Author

cc @blowery @shaunandrews

@bluefuton bluefuton force-pushed the add/sidebar-section-toggle branch from 9a1f5ff to 6ae39ed Compare January 19, 2016 20:31

const SidebarMenu = ( { children } ) => (
<li className="sidebar__menu">{ children }</li>
const SidebarMenu = ( { children, className } ) => (
Copy link
Contributor

Choose a reason for hiding this comment

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

hmmmm... do we really need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The component in general?

Copy link
Contributor

Choose a reason for hiding this comment

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

The class names on the component. What are we using it for? Do we need the class name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the parent element inside ExpandableSidebarMenu, which passes in classes based on the toggle state:

const classes = classNames( this.props.className, { 'is-toggle-open': !! this.props.expanded, 'is-togglable': true } );

Copy link
Member

Choose a reason for hiding this comment

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

Could we set these based on props for clarity instead of passing classnames?

@bluefuton bluefuton added [Status] Needs Author Reply and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jan 28, 2016
@blowery
Copy link
Contributor

blowery commented Feb 1, 2016

I think this is good to go. Whatcha think @bluefuton ? Anything left to do?

@blowery
Copy link
Contributor

blowery commented Feb 1, 2016

Are there new stats we need to track?

@bluefuton
Copy link
Contributor Author

I think this is good to go. Whatcha think @bluefuton ? Anything left to do?

I think it'd good to get it out there, then address the "scroll the picked thing into view" and open/closed state persistence as enhancements later on.

Are there new stats we need to track?

Yep, we could potentially add one for the open and close? Let me add that & then hopefully it's 🚢 time :)

@bluefuton
Copy link
Contributor Author

  • Add stat for open and close of expandable menu
  • Add stat for click of 'add' button when menu is expanded

@bluefuton bluefuton force-pushed the add/sidebar-section-toggle branch from bb94412 to b0f18c0 Compare February 1, 2016 22:00
@bluefuton bluefuton added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] Needs Author Reply labels Feb 1, 2016
shaunandrews and others added 5 commits February 2, 2016 10:42
- Adding some animations and the add button for lists and tags.
- Adding transitions for the add new list/tag in the Readers sidebar and a dismiss button for the add new input.
- Giving the focus to the add inputs when you click the add buttons for Tags and Lists.
- Adding counts and an empty state.
- Clear sidebar input in SidebarMenu, not Sidebar (elements have moved)
- Fix add input
- Cleanup old following edit link method, and rename expandable sidebar component to avoid conflict with new SidebarMenu in layout
- Rename main sidebar and ditch package.json
- Use SidebarHeading component
- Use sidebar__menu naming rather than sidebar-menu, to match new Sidebar components
- Refactored tags section into separate components
- Break out lists and teams to separate components
- Moved link methods out to helper, and fixed list highlighting
- Preserve expandable menu open/closed state using Redux
- Style cleanup
- Break out expandable menu heading to new component
- When visiting a tag or list page, open the appropriate expandable menu and scroll so that the selected item is in view
- Rename folders for Reader sidebar components
- Only focus form input when it's first opened - fixes issue with iOS keyboard not collapsing
- Reader sidebar: prevent horizontal scroll
- Stats: add stat when add button is clicked for list or tag in Reader sidebar
- Stats: add stat for open/close of lists and tags expandable menus
@blowery blowery force-pushed the add/sidebar-section-toggle branch from 103c5c8 to d709ee9 Compare February 2, 2016 15:46
@blowery
Copy link
Contributor

blowery commented Feb 2, 2016

Rebased and squashed this down to author-driven commits.

Looks like we lost the new display of tag names in the move?
screenshot

@bluefuton
Copy link
Contributor Author

Looks like we lost the new display of tag names in the move?

Sorted in 384eaf0 👍

@bluefuton
Copy link
Contributor Author

Just found an IE11 CSS bug when expanding the add input:

https://cloudup.com/c_9Gix8SUYZ

@bluefuton bluefuton 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 Feb 2, 2016
bluefuton added a commit that referenced this pull request Feb 2, 2016
Reader sidebar: toggle visibility of lists and tags
@bluefuton bluefuton merged commit d8d55b7 into master Feb 2, 2016
@bluefuton bluefuton deleted the add/sidebar-section-toggle branch February 2, 2016 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Reader The reader site on Calypso.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants