-
Notifications
You must be signed in to change notification settings - Fork 2k
Hosting dashboard: Add a custom empty state to the site list #104544
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
base: trunk
Are you sure you want to change the base?
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~44 bytes added 📈 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~46 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~35 bytes added 📈 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
e153e47
to
659ce4e
Compare
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
659ce4e
to
96458db
Compare
We have to split the changes of the Dataviews to Gutenberg. |
@@ -66,10 +67,27 @@ export default function Sites() { | |||
const { data: filteredData, paginationInfo } = filterSortAndPaginate( sites ?? [], view, fields ); | |||
const [ isModalOpen, setIsModalOpen ] = useState( false ); | |||
|
|||
const hasFilterOrSearch = ( view.filters && view.filters.length > 0 ) || view.search; | |||
|
|||
const emptyHeading = hasFilterOrSearch ? __( 'No sites found' ) : __( 'No sites' ); |
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.
When choosing the copy to show, having some sort of filter takes precedence over having no sites. That might be counter intuitive.
My first instinct was that "No sites" should take precedence. If a user has zero sites and they type in a search, surely the more important message is that the user has no sites.
But is a little more nuanced. By default we do not show "hidden" sites. But then when the user starts typing, we assume that maybe they're looking for a specific hidden site and so start showing them.
So when the user sees the "No sites" message, we don't actually know whether the user has literally no sites 😳
And when the user starts searching, they might be looking for a hidden site, and so it is better to show the message "No sites found".
Yes, I added a note about that in the PR description. I'm hoping to get some feedback about the empty state, but ultimately I need to open some GB PRs to get this whole thing merged.
@arthur791004 Since this PR also adds an extra style rule that should have been in #104479, do you think it makes sense to just merge that in to |
empty
prop to DataViews
component for rendering empty states
It has been merged into upstream via WordPress/gutenberg#70567, so any further changes should now be made directly in the upstream 😅 |
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.
Thanks @p-jackson!
should the button actually reset all filters to default?
Yes, because you could see the empty state after only applying filters. Ideally the button text would be conditional, so it would say Clear search
, Clear filters
, or Clear search and filters
depending on what the user has applied.
the text wrapping here doesn't match Figma, despite the fact I'm using the same container size.
We could use text-wrap: balance;
here to make the wrapping feel a bit better.

We should drop the column headers when the empty state is shown.

Let’s centre the empty state in the container. At the moment it appears to be top-aligned.

I noticed a small error in the illustration which has now been fixed in Figma. Can you please grab the updated version here.

Adding an |
Adding the padding fix to GB WordPress/gutenberg#70638 |
96458db
to
d39cbee
Compare
Abandoned WordPress/gutenberg#70637 |
Part of DOTDASH-14
Proposed Changes
Note
In light of ARC-422 (merging dataviews back to core) there are parts of this PR that will need to reworked.
<DataViewsEmptyState>
, based on this experimental DS component rykv85Ii9RkvP504dtqqaW-fi-158_50621 QOBjujZah0UlGDDdLKZhzi-fi-2587_192468empty
prop to<DataViews>
to allow for arbitrary empty states to be addedDataViewsEmptyState
in itsDataViews
if the user has no sites or if the filter/search returns no resultsNot in this PR
New user with no sites
This can happen for example if a user created a WordPress.com account at some stage just to comment on a blog. And they come to the dashboard at a later date.
Text search returns no results (grid mode)
Text search returns no results (table mode)
@matt-west the text wrapping here doesn't match Figma, despite the fact I'm using the same container size. But I don't think it makes sense to sweat over the wrapping. The user's search term appears in the copy so there's not much we can do about it.
A filter returns no results, but there is no search term
Grid mode on phone
Table mode on phone
Why are these changes being made?
When a data view is empty, it can be useful to give the user a call-to-action, so they can start populating the data view.
The "empty state" component is marked as experimental, so I've added it to the dashboard code rather than promoting it to
@automattic/components
. The component also needs to have custom padding based on the type of data view, which is why I thought it was best to specifically call itDataViewsEmptyState
for now.Testing Instructions
calypso.localhost:3000/v2
calypso.localhost:3000/sites?flags=dashboard/v2/backport/sites-list
Pre-merge Checklist