diff options
Diffstat (limited to 'src/view/com/auth')
-rw-r--r-- | src/view/com/auth/Onboarding.tsx | 40 | ||||
-rw-r--r-- | src/view/com/auth/withAuthRequired.tsx | 4 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/view/com/auth/Onboarding.tsx b/src/view/com/auth/Onboarding.tsx new file mode 100644 index 000000000..f43d5d93a --- /dev/null +++ b/src/view/com/auth/Onboarding.tsx @@ -0,0 +1,40 @@ +import React from 'react' +import {SafeAreaView} from 'react-native' +import {observer} from 'mobx-react-lite' +import {ErrorBoundary} from 'view/com/util/ErrorBoundary' +import {s} from 'lib/styles' +import {usePalette} from 'lib/hooks/usePalette' +import {useStores} from 'state/index' +import {useAnalytics} from 'lib/analytics/analytics' +import {CenteredView} from '../util/Views' +import {Welcome} from './onboarding/Welcome' +import {RecommendedFeeds} from './onboarding/RecommendedFeeds' + +export const Onboarding = observer(() => { + const pal = usePalette('default') + const store = useStores() + const {screen} = useAnalytics() + + React.useEffect(() => { + screen('Onboarding') + store.shell.setMinimalShellMode(true) + }, [store, screen]) + + const next = () => store.onboarding.next() + const skip = () => store.onboarding.skip() + + return ( + <CenteredView style={[s.hContentRegion, pal.view]}> + <SafeAreaView testID="noSessionView" style={s.hContentRegion}> + <ErrorBoundary> + {store.onboarding.step === 'Welcome' && ( + <Welcome skip={skip} next={next} /> + )} + {store.onboarding.step === 'RecommendedFeeds' && ( + <RecommendedFeeds next={next} /> + )} + </ErrorBoundary> + </SafeAreaView> + </CenteredView> + ) +}) diff --git a/src/view/com/auth/withAuthRequired.tsx b/src/view/com/auth/withAuthRequired.tsx index 8e57669be..c81c2d5df 100644 --- a/src/view/com/auth/withAuthRequired.tsx +++ b/src/view/com/auth/withAuthRequired.tsx @@ -9,6 +9,7 @@ import {observer} from 'mobx-react-lite' import {useStores} from 'state/index' import {CenteredView} from '../util/Views' import {LoggedOut} from './LoggedOut' +import {Onboarding} from './Onboarding' import {Text} from '../util/text/Text' import {usePalette} from 'lib/hooks/usePalette' import {STATUS_PAGE_URL} from 'lib/constants' @@ -24,6 +25,9 @@ export const withAuthRequired = <P extends object>( if (!store.session.hasSession) { return <LoggedOut /> } + if (store.onboarding.isActive) { + return <Onboarding /> + } return <Component {...props} /> }) |