Skip to content

Commit

Permalink
Merge pull request #497 from newfold-labs/fix-back-button
Browse files Browse the repository at this point in the history
fix back button issue
  • Loading branch information
officiallygod authored Feb 28, 2024
2 parents 5fbf747 + 1e52094 commit eec8728
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,20 +126,27 @@ const StepNavigation = () => {
showErrorDialog: select( nfdOnboardingStore ).getShowErrorDialog(),
};
}, [] );
const isFirstStep = null === previousStep || false === previousStep;
let isFirstStep = null === previousStep || false === previousStep;
const isLastStep = null === nextStep || false === nextStep;

let isDisabled = false;
if ( currentStep === stepWelcome ) {
if ( currentData.continueWithoutAi === true ) {
isFirstStep = false;
isDisabled = false;
} else {
isFirstStep = true;
}
}

return (
<div className="nfd-onboarding-header__step-navigation">
<ButtonGroup style={ { display: 'flex', columnGap: '0.5rem' } }>
{ isFirstStep || isLastStep ? null : (
<Back
path={ previousStep.path }
showErrorDialog={ showErrorDialog }
disabled={
currentStep === stepWelcome
? currentData.continueWithoutAi
: false
}
disabled={ isDisabled }
/>
) }
{ isLastStep ? (
Expand Down
4 changes: 1 addition & 3 deletions src/OnboardingSPA/components/StartOptions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const StartOptions = ( { questionnaire, oldFlow, options } ) => {
updateDesignRoutes,
updateInitialize,
setCurrentOnboardingData,
setContinueWithoutAi,
} = useDispatch( nfdOnboardingStore );

const switchFlow = ( newFlow ) => {
Expand All @@ -49,8 +48,7 @@ const StartOptions = ( { questionnaire, oldFlow, options } ) => {

window.nfdOnboarding.currentFlow = newFlow;
currentData.activeFlow = newFlow;
currentData.continueWithoutAi = false;
setContinueWithoutAi( false );
currentData.continueWithoutAi = true;
setCurrentOnboardingData( currentData );
if ( SITEGEN_FLOW !== newFlow ) {
updateInitialize( true );
Expand Down

0 comments on commit eec8728

Please sign in to comment.