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

Conditionally render page status views #63685

Open
richtabor opened this issue Jul 17, 2024 · 5 comments
Open

Conditionally render page status views #63685

richtabor opened this issue Jul 17, 2024 · 5 comments
Labels
[Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") Needs Design Feedback Needs general design feedback. [Type] Enhancement A suggestion for improvement.

Comments

@richtabor
Copy link
Member

I'm pulling from how WP Admin > Pages view works, where the link to the"Pending Review" filtered view is rendered only if there are posts that are set to pending review.

I think we should map that same functionality to each of the statuses in the Site Editor > Pages view.

I.e. if a view renders no results, it should not be available.

Visuals

CleanShot 2024-07-17 at 16 47 10

CleanShot 2024-07-17 at 16 51 57

@richtabor richtabor added [Type] Enhancement A suggestion for improvement. [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond labels Jul 17, 2024
@richtabor
Copy link
Member Author

cc @jameskoster for design feedback. 🙏

@richtabor richtabor added the Needs Design Feedback Needs general design feedback. label Jul 17, 2024
@jameskoster
Copy link
Contributor

This seems a bit related to #57072 in that it helps you quickly identify when a view is empty.

Hiding empty views should probably be a component-level change. In that respect would you also expect empty pattern categories to be hidden? What if there are no posts at all, should the "All posts" view be hidden? That one feels like an exception.

How about if you filter a view so that it becomes empty, does it disappear from the sidebar? 🤔

We should also consider custom views. If they're hidden when empty, users might mistakenly think the view they created has been deleted. Similarly if you create a view that returns no results, there would be no way to access the view to edit it's properties.

I like how this would tidy up the UI, but there are a few tricky nuances to consider.

@richtabor
Copy link
Member Author

In that respect would you also expect empty pattern categories to be hidden?

Yes, I would. I think they are hidden, at least in the Inserter.

What if there are no posts at all, should the "All posts" view be hidden? That one feels like an exception.

Yes, this is the exception. Here's WP Admin > Posts, with no posts:

CleanShot 2024-07-18 at 12 32 52

How about if you filter a view so that it becomes empty, does it disappear from the sidebar? 🤔

Perhaps we're too liberal with allowing removal of filters when a view is configured—at least on core-supplied views. Otherwise, if I remove the "Scheduled" filter, when I'm viewing scheduled posts, I'm not viewing scheduled posts anymore, even though the UI indicates that I am.

CleanShot 2024-07-18 at 12 36 00

CleanShot 2024-07-18 at 12 35 20

We should also consider custom views.

I'd probably treat custom views like "All" — always there. If you manipulate a filter there and save it, it's yours. You can rename the view too, so you don't get stuck in the scenario above.

@jameskoster
Copy link
Contributor

Perhaps we're too liberal with allowing removal of filters when a view is configured—at least on core-supplied views

Absolutely. That will be fixed by #60472 and #60468.

However, what if you filter the Scheduled view by an author with no scheduled pages? The count will be zero, but the view still visible.

I'd probably treat custom views like "All" — always there

Agreed.


TLDR I suppose the logic goes:

For views except "All pages" and any custom/customised views, hide the menu item when count = 0, unless the count = 0 due to customised filters. What do you think?

@richtabor
Copy link
Member Author

For views except "All pages" and any custom/customised views, hide the menu item when count = 0, unless the count = 0 due to customised filters. What do you think?

Yes, that'll work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") Needs Design Feedback Needs general design feedback. [Type] Enhancement A suggestion for improvement.
Projects
Status: No status
Development

No branches or pull requests

2 participants