From edfd326069319c80f4825eb33a74295ccf667d71 Mon Sep 17 00:00:00 2001 From: Ansh Nanda Date: Mon, 28 Aug 2023 13:37:44 -0700 Subject: move onboarding to screens --- src/lib/routes/types.ts | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/lib') diff --git a/src/lib/routes/types.ts b/src/lib/routes/types.ts index 4eb5e29d2..633fa57a5 100644 --- a/src/lib/routes/types.ts +++ b/src/lib/routes/types.ts @@ -1,5 +1,6 @@ import {NavigationState, PartialState} from '@react-navigation/native' import type {NativeStackNavigationProp} from '@react-navigation/native-stack' +import {OnboardingScreenSteps} from 'state/models/discovery/onboarding' export type {NativeStackScreenProps} from '@react-navigation/native-stack' @@ -29,6 +30,10 @@ export type CommonNavigatorParams = { CopyrightPolicy: undefined AppPasswords: undefined SavedFeeds: undefined +} & OnboardingScreenParams + +export type OnboardingScreenParams = { + [K in keyof typeof OnboardingScreenSteps]: undefined } export type BottomTabNavigatorParams = CommonNavigatorParams & { -- cgit 1.4.1 From 3f1b313fa4abd966367327aa352567ecf8d52f2d Mon Sep 17 00:00:00 2001 From: Ansh Nanda Date: Mon, 28 Aug 2023 15:41:02 -0700 Subject: add custom feed discovery to onboarding --- src/Navigation.tsx | 34 +++-- src/lib/analytics/types.ts | 1 + src/state/models/discovery/onboarding.ts | 29 ++-- src/view/com/auth/onboarding/RecommendedFeeds.tsx | 160 ++++++++++++++++++++-- src/view/com/auth/onboarding/Welcome.tsx | 38 ++++- src/view/index.ts | 2 + 6 files changed, 225 insertions(+), 39 deletions(-) (limited to 'src/lib') diff --git a/src/Navigation.tsx b/src/Navigation.tsx index 6ea92e1d4..058a15fa2 100644 --- a/src/Navigation.tsx +++ b/src/Navigation.tsx @@ -67,7 +67,7 @@ import {getRoutingInstrumentation} from 'lib/sentry' import {bskyTitle} from 'lib/strings/headings' import {JSX} from 'react/jsx-runtime' import {timeout} from 'lib/async/timeout' -import {Welcome} from 'view/com/auth/onboarding/Welcome' +import {Welcome, WelcomeHeaderRight} from 'view/com/auth/onboarding/Welcome' import {RecommendedFeeds} from 'view/com/auth/onboarding/RecommendedFeeds' const navigationRef = createNavigationContainerRef() @@ -221,18 +221,26 @@ function commonScreens(Stack: typeof HomeTab, unreadCountLabel?: string) { component={SavedFeeds} options={{title: title('Edit My Feeds')}} /> - - - - + , + }} + /> + ) } diff --git a/src/lib/analytics/types.ts b/src/lib/analytics/types.ts index f876c6d53..d56e1b615 100644 --- a/src/lib/analytics/types.ts +++ b/src/lib/analytics/types.ts @@ -122,6 +122,7 @@ interface TrackPropertiesMap { // ONBOARDING events 'Onboarding:Begin': {} 'Onboarding:Complete': {} + 'Onboarding:Skipped': {} } interface ScreenPropertiesMap { diff --git a/src/state/models/discovery/onboarding.ts b/src/state/models/discovery/onboarding.ts index 8e7a0a7b9..52521f578 100644 --- a/src/state/models/discovery/onboarding.ts +++ b/src/state/models/discovery/onboarding.ts @@ -1,12 +1,12 @@ import {makeAutoObservable} from 'mobx' import {RootStoreModel} from '../root-store' -import {NavigationProp} from 'lib/routes/types' import {hasProp} from 'lib/type-guards' +import {track} from 'lib/analytics/analytics' export const OnboardingScreenSteps = { Welcome: 'Welcome', RecommendedFeeds: 'RecommendedFeeds', - Complete: 'Complete', + Home: 'Home', } as const type OnboardingStep = @@ -34,6 +34,7 @@ export class OnboardingModel { typeof v.step === 'string' && OnboardingStepsArray.includes(v.step as OnboardingStep) ) { + console.log('hydrating onboarding', v.step) this.step = v.step as OnboardingStep } } @@ -41,31 +42,33 @@ export class OnboardingModel { this.reset() } - nextScreenName() { - if (this.step === 'Welcome') { + nextScreenName(currentScreenName?: OnboardingStep) { + if (currentScreenName === 'Welcome' || this.step === 'Welcome') { this.step = 'RecommendedFeeds' return this.step - } else if (this.step === 'RecommendedFeeds') { - this.step = 'Complete' + } else if ( + this.step === 'RecommendedFeeds' || + currentScreenName === 'RecommendedFeeds' + ) { + this.step = 'Home' return this.step - } else if (this.step === 'Complete') { - return 'Home' } else { // if we get here, we're in an invalid state, let's just go Home return 'Home' } } - complete(navigation: NavigationProp) { - navigation.navigate('Home') - } - reset() { this.step = 'Welcome' } + skip() { + track('Onboarding:Skipped') + this.step = 'Home' + } + get isComplete() { - return this.step === 'Complete' + return this.step === 'Home' } get isRemaining() { diff --git a/src/view/com/auth/onboarding/RecommendedFeeds.tsx b/src/view/com/auth/onboarding/RecommendedFeeds.tsx index 1936f4234..88fb200c6 100644 --- a/src/view/com/auth/onboarding/RecommendedFeeds.tsx +++ b/src/view/com/auth/onboarding/RecommendedFeeds.tsx @@ -1,5 +1,5 @@ import React from 'react' -import {StyleSheet, View} from 'react-native' +import {FlatList, StyleSheet, View} from 'react-native' import {Text} from 'view/com/util/text/Text' import {usePalette} from 'lib/hooks/usePalette' import {Button} from 'view/com/util/forms/Button' @@ -7,6 +7,117 @@ 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 {CustomFeed} from 'view/com/feeds/CustomFeed' +import {useCustomFeed} from 'lib/hooks/useCustomFeed' +import {makeRecordUri} from 'lib/strings/url-helpers' +import {ViewHeader} from 'view/com/util/ViewHeader' + +const TEMPORARY_RECOMMENDED_FEEDS = [ + { + did: 'did:plc:hsqwcidfez66lwm3gxhfv5in', + rkey: 'aaaf2pqeodmpy', + }, + { + did: 'did:plc:gekdk2nd47gkk3utfz2xf7cn', + rkey: 'aaap4tbjcfe5y', + }, + { + did: 'did:plc:5rw2on4i56btlcajojaxwcat', + rkey: 'aaao6g552b33o', + }, + { + did: 'did:plc:jfhpnnst6flqway4eaeqzj2a', + rkey: 'for-science', + }, + { + did: 'did:plc:7q4nnnxawajbfaq7to5dpbsy', + rkey: 'bsky-news', + }, + { + did: 'did:plc:jcoy7v3a2t4rcfdh6i4kza25', + rkey: 'astro', + }, + { + did: 'did:plc:tenurhgjptubkk5zf5qhi3og', + rkey: 'h-nba', + }, + { + did: 'did:plc:vpkhqolt662uhesyj6nxm7ys', + rkey: 'devfeed', + }, + { + did: 'did:plc:cndfx4udwgvpjaakvxvh7wm5', + rkey: 'flipboard-tech', + }, + { + did: 'did:plc:w4xbfzo7kqfes5zb7r6qv3rw', + rkey: 'blacksky', + }, + { + did: 'did:plc:lptjvw6ut224kwrj7ub3sqbe', + rkey: 'aaaotfjzjplna', + }, + { + did: 'did:plc:gkvpokm7ec5j5yxls6xk4e3z', + rkey: 'formula-one', + }, + { + did: 'did:plc:q6gjnaw2blty4crticxkmujt', + rkey: 'positivifeed', + }, + { + did: 'did:plc:l72uci4styb4jucsgcrrj5ap', + rkey: 'aaao5dzfm36u4', + }, + { + did: 'did:plc:k3jkadxv5kkjgs6boyon7m6n', + rkey: 'aaaavlyvqzst2', + }, + { + did: 'did:plc:nkahctfdi6bxk72umytfwghw', + rkey: 'aaado2uvfsc6w', + }, + { + did: 'did:plc:epihigio3d7un7u3gpqiy5gv', + rkey: 'aaaekwsc7zsvs', + }, + { + did: 'did:plc:qiknc4t5rq7yngvz7g4aezq7', + rkey: 'aaaejxlobe474', + }, + { + did: 'did:plc:mlq4aycufcuolr7ax6sezpc4', + rkey: 'aaaoudweck6uy', + }, + { + did: 'did:plc:rcez5hcvq3vzlu5x7xrjyccg', + rkey: 'aaadzjxbcddzi', + }, + { + did: 'did:plc:lnxbuzaenlwjrncx6sc4cfdr', + rkey: 'aaab2vesjtszc', + }, + { + did: 'did:plc:x3cya3wkt4n6u4ihmvpsc5if', + rkey: 'aaacynbxwimok', + }, + { + did: 'did:plc:abv47bjgzjgoh3yrygwoi36x', + rkey: 'aaagt6amuur5e', + }, + { + did: 'did:plc:ffkgesg3jsv2j7aagkzrtcvt', + rkey: 'aaacjerk7gwek', + }, + { + did: 'did:plc:geoqe3qls5mwezckxxsewys2', + rkey: 'aaai43yetqshu', + }, + { + did: 'did:plc:2wqomm3tjqbgktbrfwgvrw34', + rkey: 'authors', + }, +] type Props = NativeStackScreenProps export const RecommendedFeeds = observer(({navigation}: Props) => { @@ -14,41 +125,68 @@ export const RecommendedFeeds = observer(({navigation}: Props) => { const store = useStores() const next = () => { - const nextScreenName = store.onboarding.nextScreenName() + const nextScreenName = store.onboarding.nextScreenName('RecommendedFeeds') if (nextScreenName) { navigation.navigate(nextScreenName) } } return ( - - - - Check out some recommended feeds. Click + to add them to your list of - pinned feeds. - - + + + + Check out some recommended feeds. Click + to add them to your list of + pinned feeds. + + + } + keyExtractor={item => item.did + item.rkey} + style={{flex: 1}} + /> + + + ) + + return ( + + } + keyExtractor={item => item.did + item.rkey} + style={{flex: 1}} + /> + + ) +}) + +const Item = observer(({did, rkey}: {did: string; rkey: string}) => { + const pal = usePalette('default') + const uri = makeRecordUri(did, 'app.bsky.feed.generator', rkey) + const item = useCustomFeed(uri) + if (!item) return null + const onToggle = async () => { + if (item.isSaved) { + try { + await item.unsave() + } catch (e) { + Toast.show('There was an issue contacting your server') + console.error('Failed to unsave feed', {e}) + } + } else { + try { + await item.save() + await item.pin() + } catch (e) { + Toast.show('There was an issue contacting your server') + console.error('Failed to pin feed', {e}) + } + } + } + return ( + + + + + + + + {item.displayName} + + + + by {sanitizeHandle(item.data.creator.handle, '@')} + + + {item.data.description ? ( + + {item.data.description} + + ) : null} + + + + + + + + {item.data.likeCount || 0} + + + + + + + ) +}) + +const styles = StyleSheet.create({ + container: { + flex: 1, + marginHorizontal: 16, + justifyContent: 'space-between', + }, + title1: { + fontSize: 36, + fontWeight: '800', + textAlign: 'right', + }, + title2: { + fontSize: 58, + fontWeight: '800', + textAlign: 'right', + }, + description: { + maxWidth: 400, + marginTop: 10, + marginLeft: 'auto', + textAlign: 'right', + }, +}) diff --git a/src/view/com/auth/onboarding/Welcome.tsx b/src/view/com/auth/onboarding/Welcome.tsx index a322e4d4f..6f95c0853 100644 --- a/src/view/com/auth/onboarding/Welcome.tsx +++ b/src/view/com/auth/onboarding/Welcome.tsx @@ -41,8 +41,10 @@ export const Welcome = observer(({next, skip}: Props) => { }} /> - Welcome to - Bluesky + + Welcome to{' '} + Bluesky + @@ -98,7 +100,7 @@ const styles = StyleSheet.create({ justifyContent: 'space-between', }, title: { - fontSize: 48, + fontSize: 42, fontWeight: '800', }, row: { diff --git a/src/view/com/auth/onboarding/Welcome.web.tsx b/src/view/com/auth/onboarding/Welcome.web.tsx new file mode 100644 index 000000000..af3ca7074 --- /dev/null +++ b/src/view/com/auth/onboarding/Welcome.web.tsx @@ -0,0 +1,123 @@ +import React from 'react' +import {StyleSheet, View} from 'react-native' +import {useMediaQuery} from 'react-responsive' +import {Text} from 'view/com/util/text/Text' +import {s} from 'lib/styles' +import {usePalette} from 'lib/hooks/usePalette' +import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' +import {TitleColumnLayout} from 'view/com/util/layouts/TitleColumnLayout' +import {Button} from 'view/com/util/forms/Button' +import {observer} from 'mobx-react-lite' + +type Props = { + next: () => void + skip: () => void +} + +export const Welcome = observer(({next}: Props) => { + const pal = usePalette('default') + const horizontal = useMediaQuery({ + query: '(min-width: 1230px)', + }) + const title = ( + <> + + Welcome to + + + Bluesky + + + ) + return ( + + + + + + Bluesky is public. + + + Your posts, likes, and blocks are public. Mutes are private. + + + + + + + + Bluesky is open. + + + Never lose access to your followers and data. + + + + + + + + Bluesky is flexible. + + + Choose the algorithms that power your experience with custom feeds. + + + + + + + + + ) +}) + +const styles = StyleSheet.create({ + row: { + flexDirection: 'row', + columnGap: 20, + alignItems: 'center', + marginVertical: 20, + }, + rowText: { + flex: 1, + }, + spacer: { + height: 20, + }, +}) diff --git a/src/view/com/util/layouts/TitleColumnLayout.tsx b/src/view/com/util/layouts/TitleColumnLayout.tsx new file mode 100644 index 000000000..3ca10868e --- /dev/null +++ b/src/view/com/util/layouts/TitleColumnLayout.tsx @@ -0,0 +1,62 @@ +import React from 'react' +import {StyleProp, StyleSheet, View, ViewStyle} from 'react-native' +import {usePalette} from 'lib/hooks/usePalette' + +interface Props { + testID?: string + title: React.Component + horizontal: boolean + titleStyle?: StyleProp + contentStyle?: StyleProp +} + +export function TitleColumnLayout({ + testID, + title, + horizontal, + children, + titleStyle, + contentStyle, +}: React.PropsWithChildren) { + const pal = usePalette('default') + + const layoutStyles = horizontal ? styles2Column : styles1Column + return ( + + + {title} + + {children} + + ) +} + +const styles2Column = StyleSheet.create({ + container: { + flexDirection: 'row', + height: '100%', + }, + title: { + flex: 1, + paddingHorizontal: 40, + paddingBottom: 80, + justifyContent: 'center', + }, + content: { + flex: 2, + paddingHorizontal: 40, + justifyContent: 'center', + }, +}) + +const styles1Column = StyleSheet.create({ + container: {}, + title: { + paddingHorizontal: 40, + paddingVertical: 40, + }, + content: { + paddingHorizontal: 40, + paddingVertical: 40, + }, +}) diff --git a/src/view/shell/index.web.tsx b/src/view/shell/index.web.tsx index 16ed17a5b..9ad8007f6 100644 --- a/src/view/shell/index.web.tsx +++ b/src/view/shell/index.web.tsx @@ -20,7 +20,6 @@ import {NavigationProp} from 'lib/routes/types' const ShellInner = observer(() => { const store = useStores() const {isDesktop} = useWebMediaQueries() - const navigator = useNavigation() useEffect(() => { @@ -29,6 +28,8 @@ const ShellInner = observer(() => { }) }, [navigator, store.shell]) + const showSideNavs = + isDesktop && store.session.hasSession && !store.onboarding.isActive return ( <> @@ -36,7 +37,7 @@ const ShellInner = observer(() => { - {isDesktop && store.session.hasSession && ( + {showSideNavs && ( <> -- cgit 1.4.1 From 8ed6e72ea4a5b6546ecbbee6aa4233ee6b3aed21 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Wed, 30 Aug 2023 15:15:10 -0700 Subject: More fixes to mobile onboard --- src/lib/hooks/useWebMediaQueries.tsx | 10 +- src/view/com/auth/onboarding/RecommendedFeeds.tsx | 3 +- .../auth/onboarding/RecommendedFeedsDesktop.tsx | 126 +----------------- .../com/auth/onboarding/RecommendedFeedsItem.tsx | 142 +++++++++++++++++++++ .../com/auth/onboarding/RecommendedFeedsMobile.tsx | 39 +----- .../com/auth/onboarding/RecommendedFeedsTablet.tsx | 91 +++++++++++++ src/view/com/util/layouts/withBreakpoints.tsx | 5 +- src/view/shell/index.web.tsx | 3 +- 8 files changed, 254 insertions(+), 165 deletions(-) create mode 100644 src/view/com/auth/onboarding/RecommendedFeedsItem.tsx create mode 100644 src/view/com/auth/onboarding/RecommendedFeedsTablet.tsx (limited to 'src/lib') diff --git a/src/lib/hooks/useWebMediaQueries.tsx b/src/lib/hooks/useWebMediaQueries.tsx index 441585442..fd7e383f0 100644 --- a/src/lib/hooks/useWebMediaQueries.tsx +++ b/src/lib/hooks/useWebMediaQueries.tsx @@ -1,8 +1,14 @@ import {useMediaQuery} from 'react-responsive' +import {isNative} from 'platform/detection' export function useWebMediaQueries() { const isDesktop = useMediaQuery({ - query: '(min-width: 1230px)', + query: '(min-width: 1224px)', }) - return {isDesktop} + const isTabletOrMobile = useMediaQuery({query: '(max-width: 1224px)'}) + const isMobile = useMediaQuery({query: '(max-width: 800px)'}) + if (isNative) { + return {isMobile: true, isTabletOrMobile: true, isDesktop: false} + } + return {isMobile, isTabletOrMobile, isDesktop} } diff --git a/src/view/com/auth/onboarding/RecommendedFeeds.tsx b/src/view/com/auth/onboarding/RecommendedFeeds.tsx index 76204ce31..12c984e71 100644 --- a/src/view/com/auth/onboarding/RecommendedFeeds.tsx +++ b/src/view/com/auth/onboarding/RecommendedFeeds.tsx @@ -1,10 +1,11 @@ import 'react' import {withBreakpoints} from 'view/com/util/layouts/withBreakpoints' import {RecommendedFeedsDesktop} from './RecommendedFeedsDesktop' +import {RecommendedFeedsTablet} from './RecommendedFeedsTablet' import {RecommendedFeedsMobile} from './RecommendedFeedsMobile' export const RecommendedFeeds = withBreakpoints( RecommendedFeedsMobile, - RecommendedFeedsMobile, + RecommendedFeedsTablet, RecommendedFeedsDesktop, ) diff --git a/src/view/com/auth/onboarding/RecommendedFeedsDesktop.tsx b/src/view/com/auth/onboarding/RecommendedFeedsDesktop.tsx index d305f4a82..937313bc6 100644 --- a/src/view/com/auth/onboarding/RecommendedFeedsDesktop.tsx +++ b/src/view/com/auth/onboarding/RecommendedFeedsDesktop.tsx @@ -4,14 +4,9 @@ import {observer} from 'mobx-react-lite' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {Text} from 'view/com/util/text/Text' import {TitleColumnLayout} from 'view/com/util/layouts/TitleColumnLayout' -import {UserAvatar} from 'view/com/util/UserAvatar' import {Button} from 'view/com/util/forms/Button' -import * as Toast from 'view/com/util/Toast' +import {RecommendedFeedsItem} from './RecommendedFeedsItem' import {usePalette} from 'lib/hooks/usePalette' -import {useCustomFeed} from 'lib/hooks/useCustomFeed' -import {makeRecordUri} from 'lib/strings/url-helpers' -import {sanitizeHandle} from 'lib/strings/handles' -import {HeartIcon} from 'lib/icons' import {RECOMMENDED_FEEDS} from 'lib/constants' type Props = { @@ -64,7 +59,7 @@ export const RecommendedFeedsDesktop = observer(({next}: Props) => { contentStyle={{paddingHorizontal: 0}}> } + renderItem={({item}) => } keyExtractor={item => item.did + item.rkey} style={{flex: 1}} /> @@ -72,123 +67,6 @@ export const RecommendedFeedsDesktop = observer(({next}: Props) => { ) }) -const Item = observer(({did, rkey}: {did: string; rkey: string}) => { - const pal = usePalette('default') - const uri = makeRecordUri(did, 'app.bsky.feed.generator', rkey) - const item = useCustomFeed(uri) - if (!item) return null - const onToggle = async () => { - if (item.isSaved) { - try { - await item.unsave() - } catch (e) { - Toast.show('There was an issue contacting your server') - console.error('Failed to unsave feed', {e}) - } - } else { - try { - await item.save() - await item.pin() - } catch (e) { - Toast.show('There was an issue contacting your server') - console.error('Failed to pin feed', {e}) - } - } - } - return ( - - - - - - - - {item.displayName} - - - - by {sanitizeHandle(item.data.creator.handle, '@')} - - - {item.data.description ? ( - - {item.data.description} - - ) : null} - - - - - - - - {item.data.likeCount || 0} - - - - - - - ) -}) - const styles = StyleSheet.create({ container: { flex: 1, diff --git a/src/view/com/auth/onboarding/RecommendedFeedsItem.tsx b/src/view/com/auth/onboarding/RecommendedFeedsItem.tsx new file mode 100644 index 000000000..d16b3213e --- /dev/null +++ b/src/view/com/auth/onboarding/RecommendedFeedsItem.tsx @@ -0,0 +1,142 @@ +import React from 'react' +import {View} from 'react-native' +import {observer} from 'mobx-react-lite' +import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' +import {Text} from 'view/com/util/text/Text' +import {Button} from 'view/com/util/forms/Button' +import {UserAvatar} from 'view/com/util/UserAvatar' +import * as Toast from 'view/com/util/Toast' +import {HeartIcon} from 'lib/icons' +import {usePalette} from 'lib/hooks/usePalette' +import {useCustomFeed} from 'lib/hooks/useCustomFeed' +import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' +import {makeRecordUri} from 'lib/strings/url-helpers' +import {sanitizeHandle} from 'lib/strings/handles' + +export const RecommendedFeedsItem = observer( + ({did, rkey}: {did: string; rkey: string}) => { + const {isMobile} = useWebMediaQueries() + const pal = usePalette('default') + const uri = makeRecordUri(did, 'app.bsky.feed.generator', rkey) + const item = useCustomFeed(uri) + if (!item) return null + const onToggle = async () => { + if (item.isSaved) { + try { + await item.unsave() + } catch (e) { + Toast.show('There was an issue contacting your server') + console.error('Failed to unsave feed', {e}) + } + } else { + try { + await item.save() + await item.pin() + } catch (e) { + Toast.show('There was an issue contacting your server') + console.error('Failed to pin feed', {e}) + } + } + } + return ( + + + + + + + + {item.displayName} + + + + by {sanitizeHandle(item.data.creator.handle, '@')} + + + {item.data.description ? ( + + {item.data.description} + + ) : null} + + + + + + + + {item.data.likeCount || 0} + + + + + + + ) + }, +) diff --git a/src/view/com/auth/onboarding/RecommendedFeedsMobile.tsx b/src/view/com/auth/onboarding/RecommendedFeedsMobile.tsx index b84b75df7..a3e379883 100644 --- a/src/view/com/auth/onboarding/RecommendedFeedsMobile.tsx +++ b/src/view/com/auth/onboarding/RecommendedFeedsMobile.tsx @@ -1,14 +1,11 @@ import React from 'react' import {FlatList, StyleSheet, View} from 'react-native' +import {observer} from 'mobx-react-lite' import {Text} from 'view/com/util/text/Text' -import {usePalette} from 'lib/hooks/usePalette' import {Button} from 'view/com/util/forms/Button' -import {observer} from 'mobx-react-lite' -import {CustomFeed} from 'view/com/feeds/CustomFeed' -import {useCustomFeed} from 'lib/hooks/useCustomFeed' -import {makeRecordUri} from 'lib/strings/url-helpers' import {ViewHeader} from 'view/com/util/ViewHeader' -import {isDesktopWeb} from 'platform/detection' +import {RecommendedFeedsItem} from './RecommendedFeedsItem' +import {usePalette} from 'lib/hooks/usePalette' import {RECOMMENDED_FEEDS} from 'lib/constants' type Props = { @@ -31,7 +28,7 @@ export const RecommendedFeedsMobile = observer(({next}: Props) => { } + renderItem={({item}) => } keyExtractor={item => item.did + item.rkey} style={{flex: 1}} /> @@ -47,32 +44,6 @@ export const RecommendedFeedsMobile = observer(({next}: Props) => { ) }) -type ItemProps = { - did: string - rkey: string -} - -const Item = ({item}: {item: ItemProps}) => { - const uri = makeRecordUri(item.did, 'app.bsky.feed.generator', item.rkey) - const data = useCustomFeed(uri) - if (!data) return null - return ( - - ) -} - const styles = StyleSheet.create({ container: { flex: 1, @@ -83,7 +54,7 @@ const styles = StyleSheet.create({ marginHorizontal: 16, }, button: { - marginBottom: 24, + marginBottom: 16, marginHorizontal: 16, marginTop: 16, }, diff --git a/src/view/com/auth/onboarding/RecommendedFeedsTablet.tsx b/src/view/com/auth/onboarding/RecommendedFeedsTablet.tsx new file mode 100644 index 000000000..bc2e57ade --- /dev/null +++ b/src/view/com/auth/onboarding/RecommendedFeedsTablet.tsx @@ -0,0 +1,91 @@ +import React from 'react' +import {FlatList, StyleSheet, View} from 'react-native' +import {observer} from 'mobx-react-lite' +import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' +import {Text} from 'view/com/util/text/Text' +import {TitleColumnLayout} from 'view/com/util/layouts/TitleColumnLayout' +import {Button} from 'view/com/util/forms/Button' +import {RecommendedFeedsItem} from './RecommendedFeedsItem' +import {usePalette} from 'lib/hooks/usePalette' +import {RECOMMENDED_FEEDS} from 'lib/constants' + +type Props = { + next: () => void +} +export const RecommendedFeedsTablet = observer(({next}: Props) => { + const pal = usePalette('default') + + const title = ( + <> + Choose your + Recomended + Feeds + + Feeds are created by users to curate content. Choose some feeds that you + find interesting. + + + + + + ) + + return ( + + } + keyExtractor={item => item.did + item.rkey} + style={{flex: 1}} + /> + + ) +}) + +const styles = StyleSheet.create({ + container: { + flex: 1, + marginHorizontal: 16, + justifyContent: 'space-between', + }, + title1: { + fontSize: 24, + fontWeight: '800', + textAlign: 'right', + }, + title2: { + fontSize: 36, + fontWeight: '800', + textAlign: 'right', + }, + description: { + maxWidth: 400, + marginTop: 10, + marginLeft: 'auto', + textAlign: 'right', + }, +}) diff --git a/src/view/com/util/layouts/withBreakpoints.tsx b/src/view/com/util/layouts/withBreakpoints.tsx index 4214c1040..dc3f50dc9 100644 --- a/src/view/com/util/layouts/withBreakpoints.tsx +++ b/src/view/com/util/layouts/withBreakpoints.tsx @@ -1,6 +1,6 @@ import React from 'react' -import {useMediaQuery} from 'react-responsive' import {isNative} from 'platform/detection' +import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' export const withBreakpoints =

( @@ -9,8 +9,7 @@ export const withBreakpoints = Desktop: React.ComponentType

, ): React.FC

=> (props: P) => { - const isTabletOrMobile = useMediaQuery({query: '(max-width: 1224px)'}) - const isMobile = useMediaQuery({query: '(max-width: 800px)'}) + const {isMobile, isTabletOrMobile} = useWebMediaQueries() if (isMobile || isNative) { return diff --git a/src/view/shell/index.web.tsx b/src/view/shell/index.web.tsx index 9ad8007f6..e36439c82 100644 --- a/src/view/shell/index.web.tsx +++ b/src/view/shell/index.web.tsx @@ -28,6 +28,7 @@ const ShellInner = observer(() => { }) }, [navigator, store.shell]) + const showBottomBar = !isDesktop && !store.onboarding.isActive const showSideNavs = isDesktop && store.session.hasSession && !store.onboarding.isActive return ( @@ -52,7 +53,7 @@ const ShellInner = observer(() => { onPost={store.shell.composerOpts?.onPost} mention={store.shell.composerOpts?.mention} /> - {!isDesktop && } + {showBottomBar && } {!isDesktop && store.shell.isDrawerOpen && ( -- cgit 1.4.1