kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Add dispatch action for onboarding flow modal
rodzic
8df2a99724
commit
b148d41f31
|
@ -5,14 +5,15 @@ import { CompatRouter } from 'react-router-dom-v5-compat';
|
||||||
// @ts-ignore: it doesn't have types
|
// @ts-ignore: it doesn't have types
|
||||||
import { ScrollContext } from 'react-router-scroll-4';
|
import { ScrollContext } from 'react-router-scroll-4';
|
||||||
|
|
||||||
|
import { openModal } from 'soapbox/actions/modals';
|
||||||
import * as BuildConfig from 'soapbox/build-config';
|
import * as BuildConfig from 'soapbox/build-config';
|
||||||
import LoadingScreen from 'soapbox/components/loading-screen';
|
import LoadingScreen from 'soapbox/components/loading-screen';
|
||||||
import SiteErrorBoundary from 'soapbox/components/site-error-boundary';
|
import SiteErrorBoundary from 'soapbox/components/site-error-boundary';
|
||||||
import {
|
import {
|
||||||
ModalContainer,
|
ModalContainer,
|
||||||
OnboardingWizard,
|
|
||||||
} from 'soapbox/features/ui/util/async-components';
|
} from 'soapbox/features/ui/util/async-components';
|
||||||
import {
|
import {
|
||||||
|
useAppDispatch,
|
||||||
useAppSelector,
|
useAppSelector,
|
||||||
useLoggedIn,
|
useLoggedIn,
|
||||||
useOwnAccount,
|
useOwnAccount,
|
||||||
|
@ -30,10 +31,15 @@ const SoapboxMount = () => {
|
||||||
|
|
||||||
const { isLoggedIn } = useLoggedIn();
|
const { isLoggedIn } = useLoggedIn();
|
||||||
const { account } = useOwnAccount();
|
const { account } = useOwnAccount();
|
||||||
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
const soapboxConfig = useSoapboxConfig();
|
const soapboxConfig = useSoapboxConfig();
|
||||||
|
|
||||||
const needsOnboarding = useAppSelector(state => state.onboarding.needsOnboarding);
|
const needsOnboarding = useAppSelector(state => state.onboarding.needsOnboarding);
|
||||||
const showOnboarding = account && needsOnboarding;
|
const showOnboarding = account && needsOnboarding;
|
||||||
|
if (showOnboarding) {
|
||||||
|
dispatch(openModal('ONBOARDING_FLOW'));
|
||||||
|
}
|
||||||
const { redirectRootNoLogin, gdpr } = soapboxConfig;
|
const { redirectRootNoLogin, gdpr } = soapboxConfig;
|
||||||
|
|
||||||
// @ts-ignore: I don't actually know what these should be, lol
|
// @ts-ignore: I don't actually know what these should be, lol
|
||||||
|
@ -64,10 +70,7 @@ const SoapboxMount = () => {
|
||||||
|
|
||||||
<Route>
|
<Route>
|
||||||
<Suspense fallback={<LoadingScreen />}>
|
<Suspense fallback={<LoadingScreen />}>
|
||||||
{showOnboarding
|
<UI />
|
||||||
? <OnboardingWizard />
|
|
||||||
: <UI />
|
|
||||||
}
|
|
||||||
</Suspense>
|
</Suspense>
|
||||||
|
|
||||||
<Suspense>
|
<Suspense>
|
||||||
|
|
Ładowanie…
Reference in New Issue