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

back button hidden on Editor step #593

Merged
merged 5 commits into from
Jul 24, 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 @@ -11,8 +11,7 @@ import ButtonDark from '../../../Button/ButtonDark';

// Misc
import { store as nfdOnboardingStore } from '../../../../store';
import { stepSiteGenPreview } from '../../../../steps/SiteGen/Preview/step';
import { stepSiteGenSiteLogo } from '../../../../steps/SiteGen/SiteLogo/step';
import { stepSiteGenEditor } from '../../../../steps/SiteGen/Editor/step';

const Back = ( { path } ) => {
const { siteGenErrorStatus } = useSelect( ( select ) => {
Expand Down Expand Up @@ -51,20 +50,13 @@ const StepNavigation = () => {
}, [] );

const isFirstStep = null === previousStep || false === previousStep;
const isPreviewStep = currentStep?.path === stepSiteGenPreview?.path;

const isEditorStep = currentStep?.path === stepSiteGenEditor?.path;
return (
<div className="nfd-onboarding-header--sitegen__step-navigation">
{ isFirstStep ? (
{ isFirstStep || isEditorStep ? (
<></>
) : (
<Back
path={
isPreviewStep
? stepSiteGenSiteLogo.path
: previousStep.path
}
/>
Comment on lines -61 to -67
Copy link
Member

@officiallygod officiallygod Jul 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think why we included this was when a user does a back on Preview page he ends up on the same page again as the experience redirects him back to this page and he can never go back, But now I am unsure if a user can ever go and change the prompt again, Is that requirement fine?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are removing the navigation bar itself from the preview step. the check for the isPreviewStep is not relevant anymore on the back button. The behaviour to stay redirect back on the preview step is still the same.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's confirm if it's OK to hide the header for that step.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@officiallygod, @ajayadav09 has confirmed that we have a go ahead.

<Back path={ previousStep.path } />
) }
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/OnboardingSPA/steps/SiteGen/Preview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@
} = useDispatch( nfdOnboardingStore );

useEffect( () => {
setIsHeaderEnabled( true );
setIsHeaderEnabled( false );
setHideFooterNav( true );
setSidebarActiveView( false );
setHeaderActiveView( HEADER_SITEGEN );
setDrawerActiveView( false );
updateInitialize( true );
setIsHeaderNavigationEnabled( false );
}, [] );

Check warning on line 83 in src/OnboardingSPA/steps/SiteGen/Preview/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has missing dependencies: 'setDrawerActiveView', 'setHeaderActiveView', 'setHideFooterNav', 'setIsHeaderEnabled', 'setIsHeaderNavigationEnabled', 'setSidebarActiveView', and 'updateInitialize'. Either include them or remove the dependency array

useEffect( () => {
if (
Expand All @@ -92,7 +92,7 @@
setIsHeaderNavigationEnabled( false );
}
prevSiteGenErrorStatus.current = siteGenErrorStatus;
}, [ siteGenErrorStatus ] );

Check warning on line 95 in src/OnboardingSPA/steps/SiteGen/Preview/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has missing dependencies: 'loadHomepages' and 'setIsHeaderNavigationEnabled'. Either include them or remove the dependency array

const loadHomepages = async () => {
setIsPreviewLoading( true );
Expand Down Expand Up @@ -162,7 +162,7 @@
loadHomepages();
loadGlobalStyles();
}
}, [ themeStatus ] );

Check warning on line 165 in src/OnboardingSPA/steps/SiteGen/Preview/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

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

const handlePreview = ( slug, position ) => {
if ( ! ( slug in homepages ) ) {
Expand Down
2 changes: 1 addition & 1 deletion src/OnboardingSPA/steps/SiteGen/Preview/stylesheet.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
justify-content: center;
flex-wrap: wrap;
max-width: 500px;
padding-top: 32px;
padding-top: 81px;
min-height: 160px;
margin-bottom: 15px;

Expand Down
Loading