diff --git a/package-lock.json b/package-lock.json
index 37e0d25e8..95ae2d753 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -18139,4 +18139,4 @@
"dev": true
}
}
-}
+}
\ No newline at end of file
diff --git a/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteGen/index.js b/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteGen/index.js
index 1b28cdd1c..553c98510 100644
--- a/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteGen/index.js
+++ b/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteGen/index.js
@@ -45,18 +45,25 @@ const SiteGen = () => {
}, [ newfoldBrand ] );
const location = useLocation();
- const { currentData, initialize, pluginInstallHash, siteGenErrorStatus } =
- useSelect( ( select ) => {
- return {
- currentData:
- select( nfdOnboardingStore ).getCurrentOnboardingData(),
- initialize: select( nfdOnboardingStore ).getInitialize(),
- pluginInstallHash:
- select( nfdOnboardingStore ).getPluginInstallHash(),
- siteGenErrorStatus:
- select( nfdOnboardingStore ).getSiteGenErrorStatus(),
- };
- } );
+ const {
+ currentData,
+ initialize,
+ pluginInstallHash,
+ siteGenErrorStatus,
+ interactionDisabled,
+ } = useSelect( ( select ) => {
+ return {
+ currentData:
+ select( nfdOnboardingStore ).getCurrentOnboardingData(),
+ initialize: select( nfdOnboardingStore ).getInitialize(),
+ pluginInstallHash:
+ select( nfdOnboardingStore ).getPluginInstallHash(),
+ siteGenErrorStatus:
+ select( nfdOnboardingStore ).getSiteGenErrorStatus(),
+ interactionDisabled:
+ select( nfdOnboardingStore ).getInteractionDisabled(),
+ };
+ } );
const { setCurrentOnboardingData, updateSiteGenErrorStatus } =
useDispatch( nfdOnboardingStore );
@@ -181,7 +188,10 @@ const SiteGen = () => {
}, [ location.pathname ] );
useEffect( () => {
- if ( prevSiteGenErrorStatus.current === true && siteGenErrorStatus === false ) {
+ if (
+ prevSiteGenErrorStatus.current === true &&
+ siteGenErrorStatus === false
+ ) {
generateSiteGenData();
syncStoreToDB();
}
@@ -205,6 +215,7 @@ const SiteGen = () => {
content={ }
sidebar={ }
footer={ }
+ interactionDisabled={ interactionDisabled }
/>
);
diff --git a/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/index.js b/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/index.js
index dc1e17083..7a19f4048 100644
--- a/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/index.js
+++ b/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/index.js
@@ -60,6 +60,7 @@ function NewfoldInterfaceSkeleton(
labels,
className,
shortcuts,
+ interactionDisabled,
},
ref
) {
@@ -182,6 +183,9 @@ function NewfoldInterfaceSkeleton(
{ footer }
) }
+ { interactionDisabled && (
+
+ ) }
);
}
diff --git a/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/style.scss b/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/style.scss
index dc0741ec5..3149c5a7b 100644
--- a/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/style.scss
+++ b/src/OnboardingSPA/components/NewfoldInterfaceSkeleton/style.scss
@@ -38,6 +38,20 @@ html.nfd-interface-interface-skeleton__html-container {
top: 0;
}
}
+
+ &__overlay {
+ // z-index: to display over sidebar.
+ &--disabled {
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: rgba(var(--nfd-onboarding-secondary-rgb), 0.3);
+ cursor: not-allowed;
+ z-index: 1000001;
+ }
+ }
}
.nfd-interface-interface-skeleton__editor {
@@ -45,6 +59,7 @@ html.nfd-interface-interface-skeleton__html-container {
flex-direction: column;
flex: 0 1 100%;
overflow: hidden;
+ position: relative;
}
@include editor-left(".nfd-interface-interface-skeleton");
@@ -197,4 +212,3 @@ html.nfd-interface-interface-skeleton__html-container {
}
}
}
-
diff --git a/src/OnboardingSPA/steps/SiteGen/Editor/Header/center.js b/src/OnboardingSPA/steps/SiteGen/Editor/Header/center.js
index c6fe6106e..19882414a 100644
--- a/src/OnboardingSPA/steps/SiteGen/Editor/Header/center.js
+++ b/src/OnboardingSPA/steps/SiteGen/Editor/Header/center.js
@@ -13,26 +13,31 @@ const DropDownMenu = memo(
onRenameItemSelect,
onViewAll,
isLargeViewport,
+ onToggle,
} ) => {
+ const onMenuItemClick = ( action ) => () => {
+ action();
+ onToggle();
+ };
return (
{ ! isLargeViewport && (
<>
-
@@ -126,13 +131,14 @@ const TitleContent = memo(
/>
) }
- renderContent={ () => (
+ renderContent={ ( { onToggle } ) => (
) }
/>
diff --git a/src/OnboardingSPA/steps/SiteGen/Editor/Header/index.js b/src/OnboardingSPA/steps/SiteGen/Editor/Header/index.js
index 39e164a38..82f9f72f0 100644
--- a/src/OnboardingSPA/steps/SiteGen/Editor/Header/index.js
+++ b/src/OnboardingSPA/steps/SiteGen/Editor/Header/index.js
@@ -36,6 +36,7 @@ const StepSiteGenEditorHeader = () => {
setCurrentOnboardingData,
setSidebarActiveView,
setIsSidebarOpened,
+ setInteractionDisabled,
} = useDispatch( nfdOnboardingStore );
const { currentData, sideBarView, isSidebarOpened } = useSelect(
( select ) => {
@@ -222,6 +223,18 @@ const StepSiteGenEditorHeader = () => {
}
}, [ currentData ] );
+ useEffect( () => {
+ if ( isSaving || isRegenerating ) {
+ setInteractionDisabled( true );
+ } else {
+ setInteractionDisabled( false );
+ }
+
+ return () => {
+ setInteractionDisabled( false );
+ };
+ }, [ isSaving, isRegenerating ] );
+
return (
<>
@@ -299,9 +312,9 @@ const StepSiteGenEditorHeader = () => {
>
{ isLargeViewport
? __(
- 'Save & Continue',
- 'wp-module-onboarding'
- )
+ 'Save & Continue',
+ 'wp-module-onboarding'
+ )
: __( 'Next', 'wp-module-onboarding' ) }
{ isSaving ? (
diff --git a/src/OnboardingSPA/store/actions.js b/src/OnboardingSPA/store/actions.js
index 283681925..fbd84d0e1 100644
--- a/src/OnboardingSPA/store/actions.js
+++ b/src/OnboardingSPA/store/actions.js
@@ -326,3 +326,10 @@ export function updateSiteGenErrorStatus( siteGenErrorStatus ) {
siteGenErrorStatus,
};
}
+
+export function setInteractionDisabled( interactionDisabled ) {
+ return {
+ type: 'SET_INTERACTION_DISABLED',
+ interactionDisabled,
+ };
+}
diff --git a/src/OnboardingSPA/store/reducer.js b/src/OnboardingSPA/store/reducer.js
index f20e80ae7..86a036d24 100644
--- a/src/OnboardingSPA/store/reducer.js
+++ b/src/OnboardingSPA/store/reducer.js
@@ -34,6 +34,7 @@ export function flow(
},
},
chapter: undefined,
+ interactionDisabled: false,
},
action
) {
@@ -121,6 +122,11 @@ export function flow(
...state,
chapter: action.chapter,
};
+ case 'SET_INTERACTION_DISABLED':
+ return {
+ ...state,
+ interactionDisabled: action.interactionDisabled,
+ };
}
return state;
diff --git a/src/OnboardingSPA/store/selectors.js b/src/OnboardingSPA/store/selectors.js
index 586ac9c6d..020b8ef2b 100644
--- a/src/OnboardingSPA/store/selectors.js
+++ b/src/OnboardingSPA/store/selectors.js
@@ -470,3 +470,7 @@ export function getCustomizeSidebarData( state ) {
export function getSiteGenErrorStatus( state ) {
return state.data.flowData.sitegen.siteGenErrorStatus;
}
+
+export function getInteractionDisabled( state ) {
+ return state.flow.interactionDisabled;
+}