fix onboarding on web
This commit is contained in:
parent
742440c22d
commit
bf37913701
11 changed files with 235 additions and 113 deletions
|
@ -67,8 +67,8 @@ import {getRoutingInstrumentation} from 'lib/sentry'
|
||||||
import {bskyTitle} from 'lib/strings/headings'
|
import {bskyTitle} from 'lib/strings/headings'
|
||||||
import {JSX} from 'react/jsx-runtime'
|
import {JSX} from 'react/jsx-runtime'
|
||||||
import {timeout} from 'lib/async/timeout'
|
import {timeout} from 'lib/async/timeout'
|
||||||
import {Welcome, WelcomeHeaderRight} from 'view/com/auth/onboarding/Welcome'
|
import {RecommendedFeedsScreen} from 'view/screens/onboarding/RecommendedFeeds'
|
||||||
import {RecommendedFeeds} from 'view/com/auth/onboarding/RecommendedFeeds'
|
import {WelcomeScreen} from 'view/screens/onboarding/Welcome'
|
||||||
|
|
||||||
const navigationRef = createNavigationContainerRef<AllNavigatorParams>()
|
const navigationRef = createNavigationContainerRef<AllNavigatorParams>()
|
||||||
|
|
||||||
|
@ -223,20 +223,16 @@ function commonScreens(Stack: typeof HomeTab, unreadCountLabel?: string) {
|
||||||
/>
|
/>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
name="Welcome"
|
name="Welcome"
|
||||||
component={Welcome}
|
component={WelcomeScreen}
|
||||||
options={{
|
options={{
|
||||||
title: title('Welcome'),
|
title: title('Welcome'),
|
||||||
presentation: 'card',
|
presentation: 'card',
|
||||||
headerShown: true,
|
gestureEnabled: false,
|
||||||
headerTransparent: true,
|
|
||||||
headerTitle: '',
|
|
||||||
headerBackVisible: false,
|
|
||||||
headerRight: props => <WelcomeHeaderRight {...props} />,
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
name="RecommendedFeeds"
|
name="RecommendedFeeds"
|
||||||
component={RecommendedFeeds}
|
component={RecommendedFeedsScreen}
|
||||||
options={{
|
options={{
|
||||||
title: title('Recommended Feeds'),
|
title: title('Recommended Feeds'),
|
||||||
}}
|
}}
|
||||||
|
|
23
src/lib/hooks/useOnboarding.ts
Normal file
23
src/lib/hooks/useOnboarding.ts
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
import React from 'react'
|
||||||
|
import {useStores} from 'state/index'
|
||||||
|
import {useNavigation} from '@react-navigation/native'
|
||||||
|
import {NavigationProp} from 'lib/routes/types'
|
||||||
|
import {isNative, isWeb} from 'platform/detection'
|
||||||
|
|
||||||
|
export function useOnboarding() {
|
||||||
|
const store = useStores()
|
||||||
|
const navigation = useNavigation<NavigationProp>()
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (store.onboarding.isActive) {
|
||||||
|
if (isWeb) {
|
||||||
|
store.shell.openModal({name: 'onboarding'})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (isNative) {
|
||||||
|
navigation.navigate('Welcome')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [store.onboarding.isActive, navigation, store.shell])
|
||||||
|
}
|
|
@ -140,6 +140,10 @@ export interface PreferencesHomeFeed {
|
||||||
name: 'preferences-home-feed'
|
name: 'preferences-home-feed'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface OnboardingModal {
|
||||||
|
name: 'onboarding'
|
||||||
|
}
|
||||||
|
|
||||||
export type Modal =
|
export type Modal =
|
||||||
// Account
|
// Account
|
||||||
| AddAppPasswordModal
|
| AddAppPasswordModal
|
||||||
|
@ -175,6 +179,9 @@ export type Modal =
|
||||||
// Generic
|
// Generic
|
||||||
| ConfirmModal
|
| ConfirmModal
|
||||||
|
|
||||||
|
// Onboarding (only used on web)
|
||||||
|
| OnboardingModal
|
||||||
|
|
||||||
interface LightboxModel {}
|
interface LightboxModel {}
|
||||||
|
|
||||||
export class ProfileImageLightbox implements LightboxModel {
|
export class ProfileImageLightbox implements LightboxModel {
|
||||||
|
|
|
@ -3,14 +3,12 @@ import {FlatList, StyleSheet, View} from 'react-native'
|
||||||
import {Text} from 'view/com/util/text/Text'
|
import {Text} from 'view/com/util/text/Text'
|
||||||
import {usePalette} from 'lib/hooks/usePalette'
|
import {usePalette} from 'lib/hooks/usePalette'
|
||||||
import {Button} from 'view/com/util/forms/Button'
|
import {Button} from 'view/com/util/forms/Button'
|
||||||
import {NativeStackScreenProps} from '@react-navigation/native-stack'
|
|
||||||
import {HomeTabNavigatorParams} from 'lib/routes/types'
|
|
||||||
import {useStores} from 'state/index'
|
|
||||||
import {observer} from 'mobx-react-lite'
|
import {observer} from 'mobx-react-lite'
|
||||||
import {CustomFeed} from 'view/com/feeds/CustomFeed'
|
import {CustomFeed} from 'view/com/feeds/CustomFeed'
|
||||||
import {useCustomFeed} from 'lib/hooks/useCustomFeed'
|
import {useCustomFeed} from 'lib/hooks/useCustomFeed'
|
||||||
import {makeRecordUri} from 'lib/strings/url-helpers'
|
import {makeRecordUri} from 'lib/strings/url-helpers'
|
||||||
import {ViewHeader} from 'view/com/util/ViewHeader'
|
import {ViewHeader} from 'view/com/util/ViewHeader'
|
||||||
|
import {isDesktopWeb} from 'platform/detection'
|
||||||
|
|
||||||
const TEMPORARY_RECOMMENDED_FEEDS = [
|
const TEMPORARY_RECOMMENDED_FEEDS = [
|
||||||
{
|
{
|
||||||
|
@ -119,21 +117,15 @@ const TEMPORARY_RECOMMENDED_FEEDS = [
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
type Props = NativeStackScreenProps<HomeTabNavigatorParams, 'RecommendedFeeds'>
|
type Props = {
|
||||||
export const RecommendedFeeds = observer(({navigation}: Props) => {
|
next: () => void
|
||||||
|
}
|
||||||
|
export const RecommendedFeeds = observer(({next}: Props) => {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const store = useStores()
|
|
||||||
|
|
||||||
const next = () => {
|
|
||||||
const nextScreenName = store.onboarding.next('RecommendedFeeds')
|
|
||||||
if (nextScreenName) {
|
|
||||||
navigation.navigate(nextScreenName)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[styles.container]} testID="recommendedFeedsScreen">
|
<View style={[styles.container]} testID="recommendedFeedsScreen">
|
||||||
<ViewHeader title="Recommended Feeds" canGoBack />
|
<ViewHeader title="Recommended Feeds" canGoBack={true} />
|
||||||
<Text type="lg-medium" style={[pal.text, styles.header]}>
|
<Text type="lg-medium" style={[pal.text, styles.header]}>
|
||||||
Check out some recommended feeds. Click + to add them to your list of
|
Check out some recommended feeds. Click + to add them to your list of
|
||||||
pinned feeds.
|
pinned feeds.
|
||||||
|
@ -167,7 +159,19 @@ const Item = ({item}: {item: ItemProps}) => {
|
||||||
const data = useCustomFeed(uri)
|
const data = useCustomFeed(uri)
|
||||||
if (!data) return null
|
if (!data) return null
|
||||||
return (
|
return (
|
||||||
<CustomFeed item={data} key={uri} showDescription showLikes showSaveBtn />
|
<CustomFeed
|
||||||
|
item={data}
|
||||||
|
key={uri}
|
||||||
|
showDescription
|
||||||
|
showLikes
|
||||||
|
showSaveBtn
|
||||||
|
style={[
|
||||||
|
{
|
||||||
|
// @ts-ignore
|
||||||
|
cursor: isDesktopWeb ? 'pointer' : 'auto',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,40 +5,45 @@ import {s} from 'lib/styles'
|
||||||
import {usePalette} from 'lib/hooks/usePalette'
|
import {usePalette} from 'lib/hooks/usePalette'
|
||||||
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
||||||
import {Button} from 'view/com/util/forms/Button'
|
import {Button} from 'view/com/util/forms/Button'
|
||||||
import {NativeStackScreenProps} from '@react-navigation/native-stack'
|
|
||||||
import {HomeTabNavigatorParams} from 'lib/routes/types'
|
|
||||||
import {useStores} from 'state/index'
|
|
||||||
import {observer} from 'mobx-react-lite'
|
import {observer} from 'mobx-react-lite'
|
||||||
import {HeaderButtonProps} from '@react-navigation/native-stack/lib/typescript/src/types'
|
import {ViewHeader} from 'view/com/util/ViewHeader'
|
||||||
import {NavigationProp, useNavigation} from '@react-navigation/native'
|
import {isDesktopWeb} from 'platform/detection'
|
||||||
|
|
||||||
type Props = NativeStackScreenProps<HomeTabNavigatorParams, 'Welcome'>
|
type Props = {
|
||||||
export const Welcome = observer(({navigation}: Props) => {
|
next: () => void
|
||||||
|
skip: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Welcome = observer(({next, skip}: Props) => {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const store = useStores()
|
|
||||||
|
|
||||||
// make sure bottom nav is hidden
|
|
||||||
React.useEffect(() => {
|
|
||||||
if (!store.shell.minimalShellMode) {
|
|
||||||
store.shell.setMinimalShellMode(true)
|
|
||||||
}
|
|
||||||
}, [store.shell.minimalShellMode, store])
|
|
||||||
|
|
||||||
const next = () => {
|
|
||||||
const nextScreenName = store.onboarding.next('Welcome')
|
|
||||||
if (nextScreenName) {
|
|
||||||
navigation.navigate(nextScreenName)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[styles.container]}>
|
<View style={[styles.container]} testID="welcomeOnboarding">
|
||||||
<View testID="welcomeScreen">
|
<ViewHeader
|
||||||
|
showOnDesktop
|
||||||
|
showBorder={false}
|
||||||
|
showBackButton={false}
|
||||||
|
title=""
|
||||||
|
renderButton={() => {
|
||||||
|
return (
|
||||||
|
<Pressable
|
||||||
|
accessibilityRole="button"
|
||||||
|
style={[s.flexRow, s.alignCenter]}
|
||||||
|
onPress={skip}>
|
||||||
|
<Text style={[pal.link]}>Skip</Text>
|
||||||
|
<FontAwesomeIcon
|
||||||
|
icon={'chevron-right'}
|
||||||
|
size={14}
|
||||||
|
color={pal.colors.link}
|
||||||
|
/>
|
||||||
|
</Pressable>
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<View>
|
||||||
<Text style={[pal.text, styles.title]}>Welcome to </Text>
|
<Text style={[pal.text, styles.title]}>Welcome to </Text>
|
||||||
<Text style={[pal.text, pal.link, styles.title]}>Bluesky</Text>
|
<Text style={[pal.text, pal.link, styles.title]}>Bluesky</Text>
|
||||||
|
|
||||||
<View style={styles.spacer} />
|
<View style={styles.spacer} />
|
||||||
|
|
||||||
<View style={[styles.row]}>
|
<View style={[styles.row]}>
|
||||||
<FontAwesomeIcon icon={'globe'} size={36} color={pal.colors.link} />
|
<FontAwesomeIcon icon={'globe'} size={36} color={pal.colors.link} />
|
||||||
<View style={[styles.rowText]}>
|
<View style={[styles.rowText]}>
|
||||||
|
@ -85,35 +90,10 @@ export const Welcome = observer(({navigation}: Props) => {
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export const WelcomeHeaderRight = (props: HeaderButtonProps) => {
|
|
||||||
const {canGoBack} = props
|
|
||||||
const pal = usePalette('default')
|
|
||||||
const navigation = useNavigation<NavigationProp<HomeTabNavigatorParams>>()
|
|
||||||
const store = useStores()
|
|
||||||
return (
|
|
||||||
<Pressable
|
|
||||||
accessibilityRole="button"
|
|
||||||
style={[s.flexRow, s.alignCenter]}
|
|
||||||
onPress={() => {
|
|
||||||
if (canGoBack) {
|
|
||||||
store.onboarding.skip()
|
|
||||||
navigation.goBack()
|
|
||||||
}
|
|
||||||
}}>
|
|
||||||
<Text style={[pal.link]}>Skip</Text>
|
|
||||||
<FontAwesomeIcon
|
|
||||||
icon={'chevron-right'}
|
|
||||||
size={14}
|
|
||||||
color={pal.colors.link}
|
|
||||||
/>
|
|
||||||
</Pressable>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
marginVertical: 60,
|
marginBottom: isDesktopWeb ? 30 : 60,
|
||||||
marginHorizontal: 16,
|
marginHorizontal: 16,
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
},
|
},
|
||||||
|
|
|
@ -27,7 +27,7 @@ import * as ContentFilteringSettingsModal from './ContentFilteringSettings'
|
||||||
import * as ContentLanguagesSettingsModal from './lang-settings/ContentLanguagesSettings'
|
import * as ContentLanguagesSettingsModal from './lang-settings/ContentLanguagesSettings'
|
||||||
import * as PostLanguagesSettingsModal from './lang-settings/PostLanguagesSettings'
|
import * as PostLanguagesSettingsModal from './lang-settings/PostLanguagesSettings'
|
||||||
import * as ModerationDetailsModal from './ModerationDetails'
|
import * as ModerationDetailsModal from './ModerationDetails'
|
||||||
|
import * as OnboardingModal from './OnboardingModal'
|
||||||
import * as PreferencesHomeFeed from './PreferencesHomeFeed'
|
import * as PreferencesHomeFeed from './PreferencesHomeFeed'
|
||||||
|
|
||||||
export const ModalsContainer = observer(function ModalsContainer() {
|
export const ModalsContainer = observer(function ModalsContainer() {
|
||||||
|
@ -55,7 +55,11 @@ function Modal({modal}: {modal: ModalIface}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const onPressMask = () => {
|
const onPressMask = () => {
|
||||||
if (modal.name === 'crop-image' || modal.name === 'edit-image') {
|
if (
|
||||||
|
modal.name === 'crop-image' ||
|
||||||
|
modal.name === 'edit-image' ||
|
||||||
|
modal.name === 'onboarding'
|
||||||
|
) {
|
||||||
return // dont close on mask presses during crop
|
return // dont close on mask presses during crop
|
||||||
}
|
}
|
||||||
store.shell.closeModal()
|
store.shell.closeModal()
|
||||||
|
@ -110,6 +114,8 @@ function Modal({modal}: {modal: ModalIface}) {
|
||||||
element = <PreferencesHomeFeed.Component />
|
element = <PreferencesHomeFeed.Component />
|
||||||
} else if (modal.name === 'moderation-details') {
|
} else if (modal.name === 'moderation-details') {
|
||||||
element = <ModerationDetailsModal.Component {...modal} />
|
element = <ModerationDetailsModal.Component {...modal} />
|
||||||
|
} else if (modal.name === 'onboarding') {
|
||||||
|
element = <OnboardingModal.Component />
|
||||||
} else {
|
} else {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
40
src/view/com/modals/OnboardingModal.tsx
Normal file
40
src/view/com/modals/OnboardingModal.tsx
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
import React from 'react'
|
||||||
|
import {StyleSheet, View} from 'react-native'
|
||||||
|
import {useStores} from 'state/index'
|
||||||
|
|
||||||
|
import {usePalette} from 'lib/hooks/usePalette'
|
||||||
|
import {isDesktopWeb} from 'platform/detection'
|
||||||
|
import {Welcome} from '../auth/onboarding/Welcome'
|
||||||
|
import {observer} from 'mobx-react-lite'
|
||||||
|
import {RecommendedFeeds} from '../auth/onboarding/RecommendedFeeds'
|
||||||
|
|
||||||
|
export const snapPoints = ['90%']
|
||||||
|
|
||||||
|
export const Component = observer(({}: {}) => {
|
||||||
|
const pal = usePalette('default')
|
||||||
|
const store = useStores()
|
||||||
|
|
||||||
|
const next = () => {
|
||||||
|
const nextScreenName = store.onboarding.next()
|
||||||
|
if (nextScreenName === 'Home') {
|
||||||
|
store.shell.closeModal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={[styles.container, pal.view]} testID="onboardingModal">
|
||||||
|
{store.onboarding.step === 'Welcome' ? <Welcome next={next} /> : null}
|
||||||
|
{store.onboarding.step === 'RecommendedFeeds' ? (
|
||||||
|
<RecommendedFeeds next={next} />
|
||||||
|
) : null}
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
paddingBottom: isDesktopWeb ? 0 : 50,
|
||||||
|
maxHeight: '750px',
|
||||||
|
},
|
||||||
|
})
|
|
@ -17,6 +17,7 @@ const BACK_HITSLOP = {left: 20, top: 20, right: 50, bottom: 20}
|
||||||
export const ViewHeader = observer(function ({
|
export const ViewHeader = observer(function ({
|
||||||
title,
|
title,
|
||||||
canGoBack,
|
canGoBack,
|
||||||
|
showBackButton = true,
|
||||||
hideOnScroll,
|
hideOnScroll,
|
||||||
showOnDesktop,
|
showOnDesktop,
|
||||||
showBorder,
|
showBorder,
|
||||||
|
@ -24,6 +25,7 @@ export const ViewHeader = observer(function ({
|
||||||
}: {
|
}: {
|
||||||
title: string
|
title: string
|
||||||
canGoBack?: boolean
|
canGoBack?: boolean
|
||||||
|
showBackButton?: boolean
|
||||||
hideOnScroll?: boolean
|
hideOnScroll?: boolean
|
||||||
showOnDesktop?: boolean
|
showOnDesktop?: boolean
|
||||||
showBorder?: boolean
|
showBorder?: boolean
|
||||||
|
@ -49,7 +51,13 @@ export const ViewHeader = observer(function ({
|
||||||
|
|
||||||
if (isDesktopWeb) {
|
if (isDesktopWeb) {
|
||||||
if (showOnDesktop) {
|
if (showOnDesktop) {
|
||||||
return <DesktopWebHeader title={title} renderButton={renderButton} />
|
return (
|
||||||
|
<DesktopWebHeader
|
||||||
|
title={title}
|
||||||
|
renderButton={renderButton}
|
||||||
|
showBorder={showBorder}
|
||||||
|
/>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
} else {
|
} else {
|
||||||
|
@ -59,30 +67,32 @@ export const ViewHeader = observer(function ({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container hideOnScroll={hideOnScroll || false} showBorder={showBorder}>
|
<Container hideOnScroll={hideOnScroll || false} showBorder={showBorder}>
|
||||||
<TouchableOpacity
|
{showBackButton ? (
|
||||||
testID="viewHeaderDrawerBtn"
|
<TouchableOpacity
|
||||||
onPress={canGoBack ? onPressBack : onPressMenu}
|
testID="viewHeaderDrawerBtn"
|
||||||
hitSlop={BACK_HITSLOP}
|
onPress={canGoBack ? onPressBack : onPressMenu}
|
||||||
style={canGoBack ? styles.backBtn : styles.backBtnWide}
|
hitSlop={BACK_HITSLOP}
|
||||||
accessibilityRole="button"
|
style={canGoBack ? styles.backBtn : styles.backBtnWide}
|
||||||
accessibilityLabel={canGoBack ? 'Back' : 'Menu'}
|
accessibilityRole="button"
|
||||||
accessibilityHint={
|
accessibilityLabel={canGoBack ? 'Back' : 'Menu'}
|
||||||
canGoBack ? '' : 'Access navigation links and settings'
|
accessibilityHint={
|
||||||
}>
|
canGoBack ? '' : 'Access navigation links and settings'
|
||||||
{canGoBack ? (
|
}>
|
||||||
<FontAwesomeIcon
|
{canGoBack ? (
|
||||||
size={18}
|
<FontAwesomeIcon
|
||||||
icon="angle-left"
|
size={18}
|
||||||
style={[styles.backIcon, pal.text]}
|
icon="angle-left"
|
||||||
/>
|
style={[styles.backIcon, pal.text]}
|
||||||
) : (
|
/>
|
||||||
<FontAwesomeIcon
|
) : (
|
||||||
size={18}
|
<FontAwesomeIcon
|
||||||
icon="bars"
|
size={18}
|
||||||
style={[styles.backIcon, pal.textLight]}
|
icon="bars"
|
||||||
/>
|
style={[styles.backIcon, pal.textLight]}
|
||||||
)}
|
/>
|
||||||
</TouchableOpacity>
|
)}
|
||||||
|
</TouchableOpacity>
|
||||||
|
) : null}
|
||||||
<View style={styles.titleContainer} pointerEvents="none">
|
<View style={styles.titleContainer} pointerEvents="none">
|
||||||
<Text type="title" style={[pal.text, styles.title]}>
|
<Text type="title" style={[pal.text, styles.title]}>
|
||||||
{title}
|
{title}
|
||||||
|
@ -101,13 +111,23 @@ export const ViewHeader = observer(function ({
|
||||||
function DesktopWebHeader({
|
function DesktopWebHeader({
|
||||||
title,
|
title,
|
||||||
renderButton,
|
renderButton,
|
||||||
|
showBorder = true,
|
||||||
}: {
|
}: {
|
||||||
title: string
|
title: string
|
||||||
renderButton?: () => JSX.Element
|
renderButton?: () => JSX.Element
|
||||||
|
showBorder?: boolean
|
||||||
}) {
|
}) {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
return (
|
return (
|
||||||
<CenteredView style={[styles.header, styles.desktopHeader, pal.border]}>
|
<CenteredView
|
||||||
|
style={[
|
||||||
|
styles.header,
|
||||||
|
styles.desktopHeader,
|
||||||
|
pal.border,
|
||||||
|
{
|
||||||
|
borderBottomWidth: showBorder ? 1 : 0,
|
||||||
|
},
|
||||||
|
]}>
|
||||||
<View style={styles.titleContainer} pointerEvents="none">
|
<View style={styles.titleContainer} pointerEvents="none">
|
||||||
<Text type="title-lg" style={[pal.text, styles.title]}>
|
<Text type="title-lg" style={[pal.text, styles.title]}>
|
||||||
{title}
|
{title}
|
||||||
|
@ -195,13 +215,11 @@ const styles = StyleSheet.create({
|
||||||
width: '100%',
|
width: '100%',
|
||||||
},
|
},
|
||||||
desktopHeader: {
|
desktopHeader: {
|
||||||
borderBottomWidth: 1,
|
|
||||||
paddingVertical: 12,
|
paddingVertical: 12,
|
||||||
},
|
},
|
||||||
border: {
|
border: {
|
||||||
borderBottomWidth: 1,
|
borderBottomWidth: 1,
|
||||||
},
|
},
|
||||||
|
|
||||||
titleContainer: {
|
titleContainer: {
|
||||||
marginLeft: 'auto',
|
marginLeft: 'auto',
|
||||||
marginRight: 'auto',
|
marginRight: 'auto',
|
||||||
|
|
|
@ -21,6 +21,7 @@ import {useOnMainScroll} from 'lib/hooks/useOnMainScroll'
|
||||||
import {useAnalytics} from 'lib/analytics/analytics'
|
import {useAnalytics} from 'lib/analytics/analytics'
|
||||||
import {ComposeIcon2} from 'lib/icons'
|
import {ComposeIcon2} from 'lib/icons'
|
||||||
import {isDesktopWeb, isMobileWebMediaQuery, isWeb} from 'platform/detection'
|
import {isDesktopWeb, isMobileWebMediaQuery, isWeb} from 'platform/detection'
|
||||||
|
import {useOnboarding} from 'lib/hooks/useOnboarding'
|
||||||
|
|
||||||
const HEADER_OFFSET_MOBILE = 78
|
const HEADER_OFFSET_MOBILE = 78
|
||||||
const HEADER_OFFSET_DESKTOP = 50
|
const HEADER_OFFSET_DESKTOP = 50
|
||||||
|
@ -31,7 +32,7 @@ const POLL_FREQ = 30e3 // 30sec
|
||||||
|
|
||||||
type Props = NativeStackScreenProps<HomeTabNavigatorParams, 'Home'>
|
type Props = NativeStackScreenProps<HomeTabNavigatorParams, 'Home'>
|
||||||
export const HomeScreen = withAuthRequired(
|
export const HomeScreen = withAuthRequired(
|
||||||
observer(({navigation}: Props) => {
|
observer(({}: Props) => {
|
||||||
const store = useStores()
|
const store = useStores()
|
||||||
const pagerRef = React.useRef<PagerRef>(null)
|
const pagerRef = React.useRef<PagerRef>(null)
|
||||||
const [selectedPage, setSelectedPage] = React.useState(0)
|
const [selectedPage, setSelectedPage] = React.useState(0)
|
||||||
|
@ -39,12 +40,7 @@ export const HomeScreen = withAuthRequired(
|
||||||
const [requestedCustomFeeds, setRequestedCustomFeeds] = React.useState<
|
const [requestedCustomFeeds, setRequestedCustomFeeds] = React.useState<
|
||||||
string[]
|
string[]
|
||||||
>([])
|
>([])
|
||||||
|
useOnboarding()
|
||||||
React.useEffect(() => {
|
|
||||||
if (store.onboarding.isActive) {
|
|
||||||
navigation.navigate('Welcome')
|
|
||||||
}
|
|
||||||
}, [store.onboarding.isActive, navigation])
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const {pinned} = store.me.savedFeeds
|
const {pinned} = store.me.savedFeeds
|
||||||
|
|
20
src/view/screens/onboarding/RecommendedFeeds.tsx
Normal file
20
src/view/screens/onboarding/RecommendedFeeds.tsx
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import React from 'react'
|
||||||
|
import {NativeStackScreenProps} from '@react-navigation/native-stack'
|
||||||
|
import {HomeTabNavigatorParams} from 'lib/routes/types'
|
||||||
|
import {useStores} from 'state/index'
|
||||||
|
import {observer} from 'mobx-react-lite'
|
||||||
|
import {RecommendedFeeds} from 'view/com/auth/onboarding/RecommendedFeeds'
|
||||||
|
|
||||||
|
type Props = NativeStackScreenProps<HomeTabNavigatorParams, 'RecommendedFeeds'>
|
||||||
|
export const RecommendedFeedsScreen = observer(({navigation}: Props) => {
|
||||||
|
const store = useStores()
|
||||||
|
|
||||||
|
const next = () => {
|
||||||
|
const nextScreenName = store.onboarding.next('RecommendedFeeds')
|
||||||
|
if (nextScreenName) {
|
||||||
|
navigation.navigate(nextScreenName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return <RecommendedFeeds next={next} />
|
||||||
|
})
|
32
src/view/screens/onboarding/Welcome.tsx
Normal file
32
src/view/screens/onboarding/Welcome.tsx
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
import React from 'react'
|
||||||
|
import {NativeStackScreenProps} from '@react-navigation/native-stack'
|
||||||
|
import {HomeTabNavigatorParams} from 'lib/routes/types'
|
||||||
|
import {useStores} from 'state/index'
|
||||||
|
import {observer} from 'mobx-react-lite'
|
||||||
|
import {Welcome} from 'view/com/auth/onboarding/Welcome'
|
||||||
|
|
||||||
|
type Props = NativeStackScreenProps<HomeTabNavigatorParams, 'Welcome'>
|
||||||
|
export const WelcomeScreen = observer(({navigation}: Props) => {
|
||||||
|
const store = useStores()
|
||||||
|
|
||||||
|
// make sure bottom nav is hidden
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (!store.shell.minimalShellMode) {
|
||||||
|
store.shell.setMinimalShellMode(true)
|
||||||
|
}
|
||||||
|
}, [store.shell.minimalShellMode, store])
|
||||||
|
|
||||||
|
const next = () => {
|
||||||
|
const nextScreenName = store.onboarding.next('Welcome')
|
||||||
|
if (nextScreenName) {
|
||||||
|
navigation.navigate(nextScreenName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const skip = () => {
|
||||||
|
store.onboarding.skip()
|
||||||
|
navigation.navigate('Home')
|
||||||
|
}
|
||||||
|
|
||||||
|
return <Welcome next={next} skip={skip} />
|
||||||
|
})
|
Loading…
Add table
Add a link
Reference in a new issue