Skip to content

Commit

Permalink
Merge pull request #448 from newfold-labs/enhance/preview-step-back-b…
Browse files Browse the repository at this point in the history
…utton

Preview step enhancements
  • Loading branch information
arunshenoy99 authored Feb 1, 2024
2 parents 3ca0dc8 + fef305e commit 05ff54c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { __ } from '@wordpress/i18n';

import { store as nfdOnboardingStore } from '../../../../store';
import ButtonDark from '../../../Button/ButtonDark';
import { stepSiteGenPreview } from '../../../../steps/SiteGen/Preview/step';
import { stepSiteGenSiteLogo } from '../../../../steps/SiteGen/SiteLogo/step';

/**
* Back step Navigation button.
Expand Down Expand Up @@ -37,18 +39,28 @@ const Back = ( { path, showErrorDialog } ) => {
* @return {WPComponent} StepNavigation Component
*/
const StepNavigation = () => {
const { previousStep, showErrorDialog } = useSelect( ( select ) => {
return {
previousStep: select( nfdOnboardingStore ).getPreviousStep(),
showErrorDialog: select( nfdOnboardingStore ).getShowErrorDialog(),
};
}, [] );
const { previousStep, currentStep, showErrorDialog } = useSelect(
( select ) => {
return {
previousStep: select( nfdOnboardingStore ).getPreviousStep(),
currentStep: select( nfdOnboardingStore ).getCurrentStep(),
showErrorDialog:
select( nfdOnboardingStore ).getShowErrorDialog(),
};
},
[]
);
const isFirstStep = null === previousStep || false === previousStep;
const isPreviewStep = currentStep.path === stepSiteGenPreview.path;
return (
<div className="nfd-onboarding-header--sitegen__step-navigation">
{ isFirstStep ? null : (
<Back
path={ previousStep.path }
path={
isPreviewStep
? stepSiteGenSiteLogo.path
: previousStep.path
}
showErrorDialog={ showErrorDialog }
/>
) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ const SiteGen = () => {
.then( ( data ) => {
if ( data.body !== null ) {
currentData.sitegen.siteGenMetaStatus.currentStatus += 1;
if (
currentData.sitegen.siteGenMetaStatus
.currentStatus ===
currentData.sitegen.siteGenMetaStatus.totalCount
) {
currentData.sitegen.skipCache = false;
}
setCurrentOnboardingData( currentData );
} else if ( retryCount < MAX_RETRIES_SITE_GEN ) {
performSiteGenMetaGeneration(
Expand Down
1 change: 1 addition & 0 deletions src/OnboardingSPA/steps/SiteGen/SiteDetails/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const SiteGenSiteDetails = () => {

useEffect( () => {
if (
customerInput !== undefined &&
customerInput !== '' &&
customerInput !== currentData.sitegen.siteDetails.prompt
) {
Expand Down

0 comments on commit 05ff54c

Please sign in to comment.