From ed297dd68d723035e9fa67f08e0c8077d177f89c Mon Sep 17 00:00:00 2001 From: David Remer Date: Tue, 18 Oct 2022 13:29:31 +0300 Subject: [PATCH] Show snackbar notice [MAILPOET-4462] --- .../components/panel/activate-panel.tsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/mailpoet/assets/js/src/automation/editor/components/panel/activate-panel.tsx b/mailpoet/assets/js/src/automation/editor/components/panel/activate-panel.tsx index 23a4f21015..a039ab05f1 100644 --- a/mailpoet/assets/js/src/automation/editor/components/panel/activate-panel.tsx +++ b/mailpoet/assets/js/src/automation/editor/components/panel/activate-panel.tsx @@ -1,5 +1,6 @@ -import { useDispatch, useSelect } from '@wordpress/data'; +import { StoreDescriptor, useDispatch, useSelect } from '@wordpress/data'; import { Button } from '@wordpress/components'; +import { store as noticesStore } from '@wordpress/notices'; import { closeSmall } from '@wordpress/icons'; import { __ } from '@wordpress/i18n'; import { storeName } from '../../store'; @@ -8,11 +9,17 @@ import { MailPoet } from '../../../../mailpoet'; function PreStep({ onClose }): JSX.Element { const { activate } = useDispatch(storeName); + return ( <>
-
@@ -46,6 +53,14 @@ function PostStep({ onClose }): JSX.Element { window.location.href = MailPoet.urls.automationListing; }; + const { createErrorNotice } = useDispatch(noticesStore as StoreDescriptor); + void createErrorNotice( + __('Well done! Automation is now activated!', 'mailpoet'), + { + type: 'snackbar', + }, + ); + return ( <>