Hide notices on onboarding screen
[MAILPOET-4536]
This commit is contained in:
@@ -6,6 +6,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mailpoet-automation-is-onboarding {
|
||||||
|
.notice {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.mailpoet-automation-listing-heading {
|
.mailpoet-automation-listing-heading {
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import { useEffect } from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import { BrowserRouter } from 'react-router-dom';
|
import { BrowserRouter } from 'react-router-dom';
|
||||||
import { TopBarWithBeamer } from 'common/top_bar/top_bar';
|
import { TopBarWithBeamer } from 'common/top_bar/top_bar';
|
||||||
@@ -19,6 +20,18 @@ import {
|
|||||||
function Content(): JSX.Element {
|
function Content(): JSX.Element {
|
||||||
const count = useSelect((select) => select(storeName).getWorkflowCount());
|
const count = useSelect((select) => select(storeName).getWorkflowCount());
|
||||||
const content = count > 0 ? <AutomationListing /> : <HeroSection />;
|
const content = count > 0 ? <AutomationListing /> : <HeroSection />;
|
||||||
|
|
||||||
|
// Hide notices on onboarding screen
|
||||||
|
useEffect(() => {
|
||||||
|
const onboardingClass = 'mailpoet-automation-is-onboarding';
|
||||||
|
const element = document.querySelector('body');
|
||||||
|
if (count === 0 && !element.classList.contains(onboardingClass)) {
|
||||||
|
element.classList.add(onboardingClass);
|
||||||
|
}
|
||||||
|
if (count > 0 && element.classList.contains(onboardingClass)) {
|
||||||
|
element.classList.remove(onboardingClass);
|
||||||
|
}
|
||||||
|
}, [count]);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{content}
|
{content}
|
||||||
|
@@ -434,7 +434,8 @@ class Menu {
|
|||||||
if (!$this->featuresController->isSupported(FeaturesController::AUTOMATION)) {
|
if (!$this->featuresController->isSupported(FeaturesController::AUTOMATION)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->wp->addSubmenuPage(
|
|
||||||
|
$automationPage = $this->wp->addSubmenuPage(
|
||||||
self::MAIN_PAGE_SLUG,
|
self::MAIN_PAGE_SLUG,
|
||||||
$this->setPageTitle(__('Automations', 'mailpoet')),
|
$this->setPageTitle(__('Automations', 'mailpoet')),
|
||||||
// @ToDo Remove Beta once Automation is no longer beta.
|
// @ToDo Remove Beta once Automation is no longer beta.
|
||||||
@@ -465,6 +466,11 @@ class Menu {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// add body class for automation editor page
|
// add body class for automation editor page
|
||||||
|
$this->wp->addAction('load-' . $automationPage, function() {
|
||||||
|
$this->wp->addFilter('admin_body_class', function ($classes) {
|
||||||
|
return ltrim($classes . ' mailpoet-automation-is-onboarding');
|
||||||
|
});
|
||||||
|
});
|
||||||
$this->wp->addAction('load-' . $automationEditorPage, function() {
|
$this->wp->addAction('load-' . $automationEditorPage, function() {
|
||||||
$this->wp->addFilter('admin_body_class', function ($classes) {
|
$this->wp->addFilter('admin_body_class', function ($classes) {
|
||||||
return ltrim($classes . ' site-editor-php');
|
return ltrim($classes . ' site-editor-php');
|
||||||
|
Reference in New Issue
Block a user