-
Notifications
You must be signed in to change notification settings - Fork 4.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
[Patterns]: Pattern Directory Explorer #45237
Conversation
Size Change: +1.74 kB (0%) Total Size: 1.32 MB
ℹ️ View Unchanged
|
Nice! Thanks for working on this. Here's a gif showing the patterns tab and buttons: First off, I can't get the connection to work, not sure why that is. But I'm having some local env issues, that might be it. The other thing, there should not be two buttons, there should be only a single button, which we can call "Explore patterns" at the bottom. This button opens the pattern directory in the modal. We do not need to show any of the locally bundled patterns at all in this modal, as they are all visible from the inserter tab. |
@jasmussen you'll have to give it some time because it makes requests to fetch the pattern categories and then the patterns (there is no pagination so it fetches
Yes, I know. I just have it there for now to compare UIs easier. It will be removed in the end. |
That's really weird @jasmussen... There are other errors for me that do not affect all the patterns and the results(403 for some images), but not like the ones you have.. 🤔 . Also for the record there are no patterns in PD with test 😄 . Try something like |
lib/compat/wordpress-6.2/class-gutenberg-rest-pattern-directory-controller-6-2.php
Outdated
Show resolved
Hide resolved
lib/compat/wordpress-6.2/class-gutenberg-rest-pattern-directory-controller-6-2.php
Outdated
Show resolved
Hide resolved
Yay for browsing the pattern directory from the editor 🎉 I poked around a bit (once I fixed the Regarding your pattern directory notes… the current API is a proxy to the REST endpoint for the patterns CPT, so any query you can do on posts/pages/etc we can probably make happen in this API. For example, patterns by the wordpressdotorg user. If you need anything specific, an issue in I've added an issue about the pagination. WordPress/pattern-directory#529
Not currently, but it can be added. You'll need to ask for the user's wporg username, like on the Plugins screen (
The API layer in core should pass along the site's locale when fetching patterns, so you should see translated pattern titles and content. The category slugs stay the same. It's possible to get translated category names by using the underlying pattern API directly, but I don't think it's possible with the core endpoints yet. Added an issue WordPress/pattern-directory#530 Here's browsing the directory from a Spanish site:
On WordPress.org we order by date or by number of favorites, is that what you mean here?
I wonder if you're hitting this issue WordPress/pattern-directory#488 — are the 403s from rawpixel? |
🎉 I'm confirming that @ryelle's fix to |
Thanks for the help @anton-vlasenko , @ryelle , @ironprogrammer !
Yes, because I noticed that the results are not the same between this PR and the PD.
Yes, it seems like this would be it. In general the pagination issue is the most important one for me to be implemented in Pattern Directory. Thanks for creating the issue. |
Another really important issue is that if we make any request to the PD, the eligible patterns to be inserted are subject to the |
Pagination should now work as it does in other REST API endpoints, though |
I realized the core endpoint ( |
fb90096
to
483e227
Compare
483e227
to
bcee95f
Compare
4211ca2
to
2ac509a
Compare
Flaky tests detected in 8c4ba67. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3872690013
|
@apeatling since the PD part is merged, I updated this PR. Reviews and testing would be helpful, yes :) . Noting that I noticed this behavior:
|
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.
Did a quick first pass on the UI, I'll have some more feedback. Two things I noticed so far:
- It would be great to automatically select the "Featured" category rather than having nothing selected when the modal first pops up.
- When I insert a pattern the notice in the bottom left covers the exact spot where the "Explore all patterns" button is, meaning I'm hindered when trying to go back and add another pattern. It would be good to move these notices above the button, or remove them more quickly if the insertion sidebar is opened.
A sidebar, but I've noticed these linger for a very very long time. I'd love to reduce the time they stay on screen. |
Agree -- the messages are usually short so no need for them to linger. |
@jasmussen I've opened a PR to half the snackbar display time in #47199. |
What?
Resolves: #44611
Quick and dirty POC for adding a Pattern Directory Explorer. This will need much polishing but here it is to start addressing issues that come up and discuss. Check the below notes sections for some initial issues and know issues besides the obvious that takes some time to show results etc..
Pattern Directory Notes
allowedBlocks
in the editor or a block. What this means is that we could fetch 10 patterns for example where none of them could be inserted.. We must find a way to make this work.. We could explore how we could integrate some of these data to the PD itself(something likeblockTypes
in combination with the allowedBlockTypes passed in the request). Not sure yet..favorite
?Block editor Notes
Testing Instructions
patterns
tab in the main inserter and then click thePattern Directory
button.Screenshots or screencast
Screen.Recording.2022-10-24.at.10.48.44.AM.mov