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

Store: Add UI for product category listing #21227

Merged
merged 4 commits into from
Jan 4, 2018

Conversation

justinshreve
Copy link
Contributor

This PR adds a new product category listing page. It is behind a feature flag.

It is based off of the current taxonomy manager UI and p90Yrv-9S-p2. Also see #20295.

To Test:

  • Create a bunch of product categories via wp-admin. Make sure to give some product images and descriptions. Apply a product to a few so that some of the categories have a product count greater than 0. Create sub-categories to test nesting.
  • Apply this branch, and go to http://calypso.localhost:3000/store/products/categories/:site
  • Make sure that your categories load in correctly, and display accurate information, and are nested correctly.

Note: Clicking a category will display a 404 since editing hasn't been implemented yet.

Preview:

screen shot 2018-01-02 at 2 18 10 pm

@justinshreve justinshreve self-assigned this Jan 2, 2018
@matticbot
Copy link
Contributor

@justinshreve justinshreve requested review from kellychoffman and a team January 2, 2018 22:20
},
} );
}
return <EmptyContent title={ translate( 'No product categories found.' ) } line={ message } />;
Copy link

Choose a reason for hiding this comment

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

Hi! I've found a possible matching string that has already been translated 92 times:
translate( 'No categories found.' ) ES Score: 8

Help me improve these suggestions: react with 👎 if the suggestion doesn't make any sense, or with 👍 if it's a particularly good one (even if not implemented).

@kellychoffman
Copy link
Member

Looking good.

  1. Could we just remove the bottom border on the last category so there's not a double border?

screen shot 2018-01-02 at 7 29 57 pm

  1. The page picker thing on mobile is acting up.

Default:

screen shot 2018-01-02 at 7 29 22 pm

Opened:
screen shot 2018-01-02 at 7 29 32 pm

Thinking we can probably just scrap it since the breadcrumbs are right there and do the same thing.

Copy link
Contributor

@timmyc timmyc left a comment

Choose a reason for hiding this comment

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

handful of quick comments. So looks like a good chunk of <TaxonomyManagerList /> was similar here - just the render/display logic is different right?

The listing is working great in my testing. Filtering via the search bar is snappy even with the API sandboxed.

The only visual thing - and i know this is the same with product listings that lack images - but the grey image placeholders here always make me feel like something is still loading:

squares

^ which is out of scope here, but figured I'd bring it up and see what @kellychoffman thought on the topic :)


componentWillMount() {
const { site } = this.props;
this.props.fetchProductCategories( site.ID, {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any chance site could be null/undefined here?


componentWillReceiveProps( newProps ) {
const { site } = this.props;
const newSiteId = ( newProps.site && newProps.site.ID ) || null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we just pass in a siteId prop to make some of this logic easier here?

const { site } = this.props;
this.props.fetchProductCategories( site.ID, {
page: 1,
per_page: DEFAULT_PRODUCT_CATEGORIES_PER_PAGE,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we use DEFAULT_PRODUCT_CATEGORIES_PER_PAGE in the default query in here so we don't have to pass in the per_page here? Guessing that could result in a performance hit on the edit products pages requesting 100 vs 10 there too.


if ( searchQuery && searchQuery.length ) {
pages.forEach( page => {
if ( ! includes( this.state.requestedSearchPages, page ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since there is a bit of duplicated logic in both parts of this if/else block, should we just create a query object at the top level, and add a search: searchQuery attribute to it if there is a searchQuery? Then the looping of pages and setState call could just be combined.

Copy link
Contributor

@jameskoster jameskoster left a comment

Choose a reason for hiding this comment

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

Can we use the same cropping technique for the thumbs as we did for variations?

Currently - as we're forcing square thumbs - if a user selects a portrait or landscape image it gets smushed; https://cloudup.com/cobDsBoghLz

@kellychoffman
Copy link
Member

The only visual thing - and i know this is the same with product listings that lack images - but the grey image placeholders here always make me feel like something is still loading:

Good point. The image that actually gets added to the front end is the WC generic placeholder image, which is about to updated in the next version of WC. I'm thinking we should just use that?

@justinshreve
Copy link
Contributor Author

@kellychoffman @jameskoster @timmyc

I've made some updates here per your feedback. Thanks!

Good point. The image that actually gets added to the front end is the WC generic placeholder image, which is about to updated in the next version of WC. I'm thinking we should just use that?

Can we log an issue and handle this in a future PR? This one's already large, and we can update it in other places at the same time (product images, variations, ...)

@kellychoffman
Copy link
Member

Can we log an issue and handle this in a future PR? This one's already large, and we can update it in other places at the same time (product images, variations, ...)

Yes, agree.

Copy link
Contributor

@timmyc timmyc left a comment

Choose a reason for hiding this comment

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

Updates look good, and test well for me 🌟

requestedPages: union( this.state.requestedPages, pages ),
} );
}
const requestedPages = searchQuery && searchQuery.length && this.state.requestedSearchPages || this.state.requestedPages;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

@kellychoffman
Copy link
Member

Last request would be to have the left and right padding the same:

screen shot 2018-01-03 at 9 52 42 pm

@justinshreve justinshreve added the [Status] Needs Design Review Add this when you'd like to get a review / feedback from the Design team on your PR label Jan 4, 2018
@justinshreve
Copy link
Contributor Author

justinshreve commented Jan 4, 2018

@kellychoffman @jameskoster Fixed that padding, and logged the replacement image update at #21268. Everything look good to merge from the design side?

edit: noticed I previously left the review labels off of this. Sorry about that!

Copy link
Member

@kellychoffman kellychoffman left a comment

Choose a reason for hiding this comment

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

:shipit:

@timmyc timmyc added [Status] Ready to Merge and removed [Status] Needs Design Review Add this when you'd like to get a review / feedback from the Design team on your PR labels Jan 4, 2018
@justinshreve justinshreve merged commit 8f1aac9 into master Jan 4, 2018
@justinshreve justinshreve deleted the add/store-product-cat-list-ui branch January 4, 2018 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants