-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add success and error snackbars to the templates list page #36808
Conversation
packages/edit-site/src/components/add-new-template/new-template-part.js
Outdated
Show resolved
Hide resolved
Size Change: +704 B (0%) Total Size: 1.1 MB
ℹ️ View Unchanged
|
Since we don't have a trash feature, it would be excellent to add an undo affordance to the deletion Snackbar. We should also display a snackbar when customisations are cleared – again with undo – so it may be worth holding off on merging this until #36802 is closed? |
I'm not a huge fan of the "Template created. Navigating to the editor..." notice. On Firefox the page freezes while that notice is fading in so the whole thing looks kinda strange. I think don't bother with a notice on creation or, as discussed above, show it after the navigation. I tested Clear customizations on this branch and didn't see a notice. We should add that. |
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.
Code looks good!
packages/edit-site/src/components/add-new-template/new-template-part.js
Outdated
Show resolved
Hide resolved
|
||
async function createTemplatePart( { title, area } ) { | ||
if ( ! title ) { | ||
createErrorNotice( __( 'Title is not defined.' ), { |
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.
How would this happen? 🙂 I guess it's okay to leave it just in case.
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.
Yeah, it will never happen for regular users. Maybe we should just remove this check altogether.
packages/edit-site/src/components/add-new-template/new-template.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Robert Anderson <robert@noisysocks.com>
@@ -76,29 +75,6 @@ describe( 'actions', () => { | |||
} ); | |||
} ); | |||
|
|||
describe( 'removeTemplate', () => { |
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.
I removed the unit test because I don't think it's serving any purpose besides slowing us down. We could add it back if the action becomes more complicated. Or if anyone thinks otherwise.
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.
Yeah, agree with removing it. There are already tests for deleteEntityRecord, and the notices should ideally be tested with e2e tests if they're to be tested.
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.
LGTM - thanks @kevin940726
* Add success and error snackbars to the list page * Fix Unit Test error * Apply 'is-navigation-open' to interface skeleton * Fix NavigationToggle unit test * Apply suggestions from code review Co-authored-by: Robert Anderson <robert@noisysocks.com> * Use deleting * Remove snackbars for creation * Add notices for reverting * Fix test * Add getLastEntityDeleteError * Add comment Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com> Co-authored-by: Robert Anderson <robert@noisysocks.com>
One little inconsistency that'd be nice to fix here is that when you delete a template, we include the template name in the Snackbar, but when you revert a template we do not. I suppose we can address that when we add the undo affordance. |
* Add success and error snackbars to the list page * Fix Unit Test error * Apply 'is-navigation-open' to interface skeleton * Fix NavigationToggle unit test * Apply suggestions from code review Co-authored-by: Robert Anderson <robert@noisysocks.com> * Use deleting * Remove snackbars for creation * Add notices for reverting * Fix test * Add getLastEntityDeleteError * Add comment Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com> Co-authored-by: Robert Anderson <robert@noisysocks.com>
* Add success and error snackbars to the list page * Fix Unit Test error * Apply 'is-navigation-open' to interface skeleton * Fix NavigationToggle unit test * Apply suggestions from code review Co-authored-by: Robert Anderson <robert@noisysocks.com> * Use deleting * Remove snackbars for creation * Add notices for reverting * Fix test * Add getLastEntityDeleteError * Add comment Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com> Co-authored-by: Robert Anderson <robert@noisysocks.com>
… or avatar (#36763) * Show theme, plugin or author in Added By column with appropriate icon or avatar * Add success and error snackbars to the templates list page (#36808) * Add success and error snackbars to the list page * Fix Unit Test error * Apply 'is-navigation-open' to interface skeleton * Fix NavigationToggle unit test * Apply suggestions from code review Co-authored-by: Robert Anderson <robert@noisysocks.com> * Use deleting * Remove snackbars for creation * Add notices for reverting * Fix test * Add getLastEntityDeleteError * Add comment Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com> Co-authored-by: Robert Anderson <robert@noisysocks.com> * Show theme, plugin or author in Added By column with appropriate icon or avatar * Fix plugin name rendering * Add blue dot for customize templates * Add tooltip and tidy up logic * Fallback to showin slug * Handle missing author by showing template as a customized theme template * Fallback to site name and logo * Make the avatars load in a fancy way * Avoid icon stretch on narrow viewports * Fix dodgy rebase * Use core version of template and template part post types and REST endpoints * Revert "Use core version of template and template part post types and REST endpoints" This reverts commit 6b40260. * Rename to AddedBy * Use onLoad Co-authored-by: Kai Hao <kevin830726@gmail.com> Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com> Co-authored-by: Robert Anderson <robert@noisysocks.com>
… or avatar (#36763) * Show theme, plugin or author in Added By column with appropriate icon or avatar * Add success and error snackbars to the templates list page (#36808) * Add success and error snackbars to the list page * Fix Unit Test error * Apply 'is-navigation-open' to interface skeleton * Fix NavigationToggle unit test * Apply suggestions from code review Co-authored-by: Robert Anderson <robert@noisysocks.com> * Use deleting * Remove snackbars for creation * Add notices for reverting * Fix test * Add getLastEntityDeleteError * Add comment Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com> Co-authored-by: Robert Anderson <robert@noisysocks.com> * Show theme, plugin or author in Added By column with appropriate icon or avatar * Fix plugin name rendering * Add blue dot for customize templates * Add tooltip and tidy up logic * Fallback to showin slug * Handle missing author by showing template as a customized theme template * Fallback to site name and logo * Make the avatars load in a fancy way * Avoid icon stretch on narrow viewports * Fix dodgy rebase * Use core version of template and template part post types and REST endpoints * Revert "Use core version of template and template part post types and REST endpoints" This reverts commit 6b40260. * Rename to AddedBy * Use onLoad Co-authored-by: Kai Hao <kevin830726@gmail.com> Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com> Co-authored-by: Robert Anderson <robert@noisysocks.com>
Description
Part of #36597.
Add success and error snackbars to the templates list page. It will now:
Since that the snackbars have similar background as the navigation panel, they will be pushed right a little bit when the panel is opened.
How has this been tested?
tt1-blocks
themethrow
), you should notice error snackbars.Screenshots
Kapture.2021-11-24.at.15.52.50.mp4
Types of changes
New feature
Checklist:
*.native.js
files for terms that need renaming or removal).