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

Add Site Logo Error State #592

Merged
merged 2 commits into from
Jul 24, 2024
Merged
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
83 changes: 43 additions & 40 deletions src/OnboardingSPA/steps/SiteGen/SiteLogo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
ACTION_SITEGEN_LOGO_SKIPPED,
} from '../../../utils/analytics/hiive/constants';
import { SITEGEN_FLOW } from '../../../data/flows/constants';
import { SiteGenStateHandler } from '../../../components/StateHandlers';

const SiteGenSiteLogo = () => {
const [ siteLogo, setSiteLogo ] = useState();
Expand Down Expand Up @@ -71,7 +72,7 @@
}
setIsFooterNavAllowed( false );
getEditedEntityRecord( 'root', 'site' );
}, [] );

Check warning on line 75 in src/OnboardingSPA/steps/SiteGen/SiteLogo/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

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

const resetSiteLogo = () => {
const currentDataCopy = { ...currentData };
Expand Down Expand Up @@ -121,49 +122,51 @@
const content = getContents();

return (
<CommonLayout
isCentered
className="nfd-onboarding-step--site-gen__site-logo"
>
<div className="nfd-onboarding-step--site-gen__site-logo__container">
<AIHeading title={ content.heading } />
<ImageUploaderWithText
image={ siteLogo }
imageSetter={ handleSiteLogo }
onFailure={ handleFailure }
/>
<div className="nfd-onboarding-step--site-gen__site-logo__container__buttons">
<SkipButton
callback={ () => resetSiteLogo() }
className="nfd-onboarding-step--site-gen__site-logo__container__buttons__skip"
text={ content.buttons.skip }
<SiteGenStateHandler>
<CommonLayout
isCentered
className="nfd-onboarding-step--site-gen__site-logo"
>
<div className="nfd-onboarding-step--site-gen__site-logo__container">
<AIHeading title={ content.heading } />
<ImageUploaderWithText
image={ siteLogo }
imageSetter={ handleSiteLogo }
onFailure={ handleFailure }
/>
{ isLargeViewport && (
<NextButtonSiteGen
callback={ () => {
if ( siteLogo ) {
trackOnboardingEvent(
new OnboardingEvent(
ACTION_LOGO_ADDED,
undefined,
{
source: SITEGEN_FLOW,
}
)
);
}
} }
text={ content.buttons.next }
disabled={
siteLogo === undefined || siteLogo?.id === 0
? true
: false
}
<div className="nfd-onboarding-step--site-gen__site-logo__container__buttons">
<SkipButton
callback={ () => resetSiteLogo() }
className="nfd-onboarding-step--site-gen__site-logo__container__buttons__skip"
text={ content.buttons.skip }
/>
) }
{ isLargeViewport && (
<NextButtonSiteGen
callback={ () => {
if ( siteLogo ) {
trackOnboardingEvent(
new OnboardingEvent(
ACTION_LOGO_ADDED,
undefined,
{
source: SITEGEN_FLOW,
}
)
);
}
} }
text={ content.buttons.next }
disabled={
siteLogo === undefined || siteLogo?.id === 0
? true
: false
}
/>
) }
</div>
</div>
</div>
</CommonLayout>
</CommonLayout>
</SiteGenStateHandler>
);
};

Expand Down
Loading