Skip to content
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

Preview step enhancements #448

Merged
merged 3 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
.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 Expand Up @@ -146,13 +153,13 @@
initializePlugins( pluginInstallHash );
setInterval( cronTrigger, 45000 );
}
}, [ initialize ] );

Check warning on line 156 in src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteGen/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has a missing dependency: 'pluginInstallHash'. Either include it or remove the dependency array

Check warning on line 156 in src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteGen/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has a missing dependency: 'pluginInstallHash'. Either include it or remove the dependency array

useEffect( () => {
syncStoreToDB();
generateSiteGenData();
handlePreviousStepTracking();
}, [ location.pathname ] );

Check warning on line 162 in src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteGen/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has missing dependencies: 'generateSiteGenData', 'handlePreviousStepTracking', and 'syncStoreToDB'. Either include them or remove the dependency array

Check warning on line 162 in src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteGen/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has missing dependencies: 'generateSiteGenData', 'handlePreviousStepTracking', and 'syncStoreToDB'. Either include them or remove the dependency array

useEffect( () => {
initializeThemes();
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 @@ -45,10 +45,11 @@
return setCustomerInput( currentData.sitegen.siteDetails.prompt );
}
setIsFooterNavAllowed( false );
}, [] );

Check warning on line 48 in src/OnboardingSPA/steps/SiteGen/SiteDetails/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has missing dependencies: 'currentData.sitegen.siteDetails.prompt', 'setDrawerActiveView', 'setHeaderActiveView', 'setHideFooterNav', 'setIsFooterNavAllowed', 'setIsHeaderEnabled', and 'setSidebarActiveView'. Either include them or remove the dependency array

Check warning on line 48 in src/OnboardingSPA/steps/SiteGen/SiteDetails/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has missing dependencies: 'currentData.sitegen.siteDetails.prompt', 'setDrawerActiveView', 'setHeaderActiveView', 'setHideFooterNav', 'setIsFooterNavAllowed', 'setIsHeaderEnabled', and 'setSidebarActiveView'. Either include them or remove the dependency array

useEffect( () => {
if (
customerInput !== undefined &&
customerInput !== '' &&
customerInput !== currentData.sitegen.siteDetails.prompt
) {
Expand All @@ -59,7 +60,7 @@
setCurrentOnboardingData( currentData );
}
setIsFooterNavAllowed( isValidInput );
}, [ customerInput ] );

Check warning on line 63 in src/OnboardingSPA/steps/SiteGen/SiteDetails/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has missing dependencies: 'currentData', 'isValidInput', 'setCurrentOnboardingData', and 'setIsFooterNavAllowed'. Either include them or remove the dependency array

Check warning on line 63 in src/OnboardingSPA/steps/SiteGen/SiteDetails/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has missing dependencies: 'currentData', 'isValidInput', 'setCurrentOnboardingData', and 'setIsFooterNavAllowed'. Either include them or remove the dependency array

return (
<CommonLayout isCentered>
Expand Down
Loading