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

Global styles revisions: add pagination #53621

Closed
ramonjd opened this issue Aug 14, 2023 · 16 comments · Fixed by #56799
Closed

Global styles revisions: add pagination #53621

ramonjd opened this issue Aug 14, 2023 · 16 comments · Fixed by #56799
Assignees
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json Needs Design Feedback Needs general design feedback. Needs Design Needs design efforts. [Type] Enhancement A suggestion for improvement.

Comments

@ramonjd
Copy link
Member

ramonjd commented Aug 14, 2023

What problem does this address?

Pagination capability was added to the Global styles revisions endpoint in #52095

At the moment the maximum amount of Global styles revisions we display in the site editor UI is 100.

It's conceivable that sites will have more than this, and therefore would find pagination helpful.

What is your proposed solution?

  • Utilize pagination parameters in the global styles revisions rest endpoint to display n amount of global styles revisions in the UI.
  • Add pagination controls to the UI.
@ramonjd ramonjd added [Type] Enhancement A suggestion for improvement. Needs Design Needs design efforts. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Aug 14, 2023
@ramonjd ramonjd self-assigned this Aug 14, 2023
@ramonjd ramonjd changed the title Global styles revision: add pagination Global styles revisions: add pagination Aug 14, 2023
@ramonjd ramonjd moved this to ❓ Triage in WordPress 6.4 Editor Tasks Aug 14, 2023
@annezazu annezazu moved this from Triage to Needs Design in WordPress 6.4 Editor Tasks Aug 30, 2023
@allisonplus
Copy link

It'd be great to see pagination options be fully expanded (see screenshot) to include Prev/Next as well as total number of pages included so user knows total results.

Image

@apeatling
Copy link
Contributor

Had a crack at the start of a design for this. Seems logical that this would be the general direction based on other pagination. There isn't enough space for the total number of items, this could perhaps go up in the top to the right of the "Revisions" title.

Screenshot 2023-09-07 at 1 09 59 PM

@ramonjd
Copy link
Member Author

ramonjd commented Sep 8, 2023

Thanks for the help on direction folks. The first task I believe is to ensure that the core data store can handle and manage the incoming revision entities and related pagination queries. I'm going to take a look at this.

@jasmussen
Copy link
Contributor

A couple of more options:

Frame 1

Notably I think we can be a bit more compact with the use of space, by using borderless buttons, by skipping the first-page/last-page buttons, and by disabling the left button on the first page, etc.

I'd also start simple, I'm not quite sure how many pages of revisions we can expect here, but if we end up with hundreds of pages we should probably still skip the first-page/last-page buttons in favor of the ... system. What do you think?

@ramonjd
Copy link
Member Author

ramonjd commented Sep 13, 2023

we should probably still skip the first-page/last-page buttons in favor of the ... system. What do you think?

Sounds good to me. We could have a threshold, e.g., when the pages hit n we switch to ... 👍🏻

@ramonjd ramonjd moved this from Needs Design to Punted to 6.5 in WordPress 6.4 Editor Tasks Sep 14, 2023
@jasmussen
Copy link
Contributor

jasmussen commented Sep 14, 2023

Yep, it can be tweaked to what fits. E.g. at most 5 items between the ellipses:

  • 1 2 3 ... 49
  • 1 ... 47 48 49
  • 32 33 ... 48 49

@apeatling
Copy link
Contributor

Looks good, and makes sense to start simple with it. 👍

@ramonjd
Copy link
Member Author

ramonjd commented Sep 15, 2023

Conversation about state and how to fetch post type revisions going on over in:

@ramonjd
Copy link
Member Author

ramonjd commented Oct 11, 2023

Update

Getting closer to finalizing the core data API in #54046, which will enable this feature.

I might build the UI on top of that PR to demonstrate the designs. Cheers!

@ramonjd
Copy link
Member Author

ramonjd commented Oct 11, 2023

The underlying API works fine 👍🏻

2023-10-11.17.28.35.mp4

Slight speed bump: we're adding 2 x extra revision items on the frontend: an "unsaved" state at the start of the revisions array, and a "default theme" state at the end. This means we'll have to take these into account when building pages from the API response, and recalculate the offsets 🤔

@apeatling
Copy link
Contributor

@pablohoneyhoney @mtias You'd talked about now wanting to use numbers in the pagination for style revisions. Should we move forward with a "Load More" style pagination for this?

@apeatling apeatling added the Needs Design Feedback Needs general design feedback. label Nov 20, 2023
@ramonjd
Copy link
Member Author

ramonjd commented Nov 21, 2023

I know it's not all about me 🤣 but the "Load more" approach would effectively side-step the pagination recalculation mania I came up against in testing.

@ramonjd
Copy link
Member Author

ramonjd commented Nov 24, 2023

You'd talked about now wanting to use numbers in the pagination for style revisions. Should we move forward with a "Load More" style pagination for this?

One argument for pagination is if users want to go to the start of history, and they have many revisions, they can immediately. Users may need to click multiple times to get to older content with a "Load more" button.

We "could" offer both, i.e., a component that lets the user choose between "Load more" and "Pagination" and "X" view/filter. Maybe I'm saying this because I've just been playing with dataviews. 😄

Or, if we go with pagination initially, a dropdown menu to choose the number of items to display per page.

@ramonjd
Copy link
Member Author

ramonjd commented Dec 7, 2023

Have a WIP idea going on in:

2023-12-07.19.02.33.mp4

@ramonjd
Copy link
Member Author

ramonjd commented Dec 14, 2023

Latest from #56799

2023-12-14.19.22.51.mp4

@ramonjd
Copy link
Member Author

ramonjd commented Dec 15, 2023

Another version

@apeatling with the Apply button inline now:

2023-12-15.11.30.33.mp4

@github-project-automation github-project-automation bot moved this from Punted to 6.5 to Done in WordPress 6.4 Editor Tasks Dec 21, 2023
@github-project-automation github-project-automation bot moved this from 📥 Todo to ✅ Done in WordPress 6.5 Editor Tasks Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json Needs Design Feedback Needs general design feedback. Needs Design Needs design efforts. [Type] Enhancement A suggestion for improvement.
Projects
No open projects
Status: Done
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants