-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Conversation
}, | ||
} ); | ||
} | ||
return <EmptyContent title={ translate( 'No product categories found.' ) } line={ message } />; |
There was a problem hiding this comment.
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).
There was a problem hiding this 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:
^ 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, { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 ) ) { |
There was a problem hiding this comment.
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.
There was a problem hiding this 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
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? |
@kellychoffman @jameskoster @timmyc I've made some updates here per your feedback. Thanks!
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. |
There was a problem hiding this 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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
@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! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
http://calypso.localhost:3000/store/products/categories/:site
Note: Clicking a category will display a 404 since editing hasn't been implemented yet.
Preview: