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

Patterns: Add a curation filter to the UI #584

Merged
merged 6 commits into from
Jun 9, 2023
Merged

Conversation

ryelle
Copy link
Contributor

@ryelle ryelle commented Jun 5, 2023

This adds a new filter to the UI for "curation", as described in #580— "curated" patterns are those which have been picked to auto-load into core. The new filter is a dropdown with "curated" and "community", which lets the viewer switch between those two views. It defaults to curated on home & category archives, and uses curated for the empty state recommendations.

The author archive, favorites, and my patterns don't have this filter, and default to showing "all" patterns.

Fixes #580

Note, this is based off #583, which adds the parameter to the API endpoint.

Screenshots

I applied this to my sandbox to take screenshots, so this is using production patterns.

Curated Community
Home, default sort home-curated home-community
Home, sorted by popular home-curated-popular home-community-popular
Category, default sort category-curated category-community
Favorites & My Patterns have no changes, but screenshots for reference

favorites

my-patterns

On medium-smaller screens, the filters wrap, then at 782px the menu collapses.

This new change means that the Call to Action menu item defaults to empty (https://wordpress.org/patterns/categories/call-to-action/), but you can see here the empty state also uses the "curated" patterns.

home-curated-cta-empty

How to test the changes in this Pull Request:

  1. Check out the branch and build the project
  2. Make sure you have some patterns with the core keyword: /wp-admin/edit.php?wporg-pattern-keyword=core&post_type=wporg-pattern&post_parent=0&post_status=publish — if not, you should be able to add some via wp-admin
  3. View the homepage, it should default to the core patterns
  4. Try using the filters on the UI to switch to community
  5. Navigate through categories, it should persist your chosen curation
  6. My Patterns, My Favorites, and author archives should still work, without a curation filter

@ryelle ryelle self-assigned this Jun 5, 2023
@ryelle ryelle added the [Component] Theme The frontend of the pattern directory, pattern lists UI label Jun 5, 2023
@jasmussen
Copy link

Looks good to me!

@fcoveram
Copy link

fcoveram commented Jun 6, 2023

Same. It looks good 👍

Copy link
Contributor

@renintw renintw left a comment

Choose a reason for hiding this comment

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

Tested on sandbox and worked as described. Codes-wise look good to me as well 👍

This new change means that the Call to Action menu item defaults to empty (https://wordpress.org/patterns/categories/call-to-action/), but you can see here the empty state also uses the "curated" patterns.

Does it need to make any changes to it accordingly, maybe rephrase the text under No results found? Any better ways to handle this?

@StevenDufresne
Copy link
Collaborator

I probably missed this in the original issue, but does this mean I can never actually see "all" the patterns? I have to either subsection them by "community/curated"?

What if I don't care about whether they are community or curated and just want them all?

@annezazu
Copy link
Collaborator

annezazu commented Jun 7, 2023

Good point. I can see where folks would want to see all and we could still prioritize by curated. What do you think @richtabor? This looks good as an initial iteration though.

@jasmussen
Copy link

The missing "all" is very much intentional, and an attempt to bring a little structure to what is currently an unfortunate kitchen sink. I like to think that as we roll out potential features in the future like author patterns, pattern bundles, clearer guidelines for each category, related patterns etc, we can see what that does to the curation and then revisit.

@ryelle
Copy link
Contributor Author

ryelle commented Jun 7, 2023

Technically, we do have the ability to show all, just no UI to trigger it. It's not prioritized by curated (because that introduces a new sort order variable), but it does exist. In case we want to bring it back (now or later).

Base automatically changed from add/curation-parameter to trunk June 9, 2023 16:52
Core or community should be specifically requested to not break other API responses.
This ensures the `isLoading` check in ContextBar uses the correct (modified) query with the curation value, otherwise it checks the wrong query key and sticks on the "loading" state.
@ryelle ryelle merged commit 33308fa into trunk Jun 9, 2023
@ryelle ryelle deleted the add/curation-filters branch June 9, 2023 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Component] Theme The frontend of the pattern directory, pattern lists UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add select for filtering the pattern directory
6 participants