WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.4k stars 4.16k forks source link

Dataviews: Improve the 'No results' view #61442

Open jarekmorawski opened 5 months ago

jarekmorawski commented 5 months ago

When users apply filters or search using terms that yield no results in the data views, the app currently says No results. I believe we can make it more helpful to users by tweaking the copy to focus on solutions and tailoring the message's appearance so it's easier to read and interact with.

The button in the message would be contextual, meaning that it'd change depending on the context (Add new page, Add new post, Add new pattern, etc).

List

jameskoster commented 5 months ago

In cases where no records exist, "No results found" reads a little strange, as does the accompanying text. In that scenario the messaging could be more focussed around adding the first $post_type.

jarekmorawski commented 5 months ago

The empty state is a slightly different use case (it appears without additional user input, like filtering), but I agree it'd use a similar treatment. Here's an attempt. The word pattern appears twice because it's good for the button to have a descriptive label.

Empty

It'd be nice to make the empty state extensible so third-party plugins could add extra elements, like buttons and buttons, without writing custom code.

jameskoster commented 4 months ago

I wonder if it would make sense to implement this as a dedicated component, cc @WordPress/gutenberg-components.

ntsekouras commented 4 months ago

I wonder if it would make sense to implement this as a dedicated component

I think if we did that, it would make sense to be in dataviews package and just be a think wrapper with some base styles (border maybe, etc..). We have to think about what consumer would want there and if lots of flexibility is needed, they should be allowed to pass a component of their own.

keoshi commented 4 months ago

I agree that we could build a unified design pattern, even if it's being shared between two different components:

Explored both of these in the context of A4A and have a few suggestions:

Screenshots: image image

tyxla commented 4 months ago

I wonder if it would make sense to implement this as a dedicated component, cc @WordPress/gutenberg-components.

Sounds like a very niche use case that I wouldn't recommend a generic component for. I don't see a good need for it because there's little to no interaction going on inside it. Also, there's a high chance that adding structure and providing a certain API won't cover certain use cases, making the component either useless or too limiting.

jameskoster commented 4 months ago

I think if we did that, it would make sense to be in dataviews package and just be a think wrapper with some base styles

Sounds good to me. The motivation is to be consistent in terms of design across data views, but still offer some flexibility. Features would likely include:

ntsekouras commented 4 months ago

Sounds like we need some mockups then 😄

jameskoster commented 4 months ago

Yup we should make a detailed spec, the concepts shared already by Jarek and Filipe seem like good starting points.