Onboarding & feed fixes (#1602)
* Fix: improve the 'end of feed' detection condition * Fix the feeds link on mobile in the empty state * Align the following empty state better on web * Dont autofocus the search input in the search tab * Fix the error boundary render * Add 'end of feed' CTA to following feed * Reduce the default feeds to discover now that we have feed-selection during onboarding * Fix case where loading spinner fails to stop rendering in bottom of feed * Fix: dont show loading spinner at footer of feed when refreshing * Fix: dont fire reminders during onboarding * Optimize adding feeds and update to mirror the api behaviors more closely * Use the lock in preferences to avoid clobbering in-flight updates * Refresh the feed after onboarding to ensure content is visible * Remove the now-incorrect comment * Tune copyzio/stable
parent
a76fb78d53
commit
b1a1bae02e
|
@ -79,6 +79,7 @@ export async function DEFAULT_FEEDS(
|
||||||
serviceUrl: string,
|
serviceUrl: string,
|
||||||
resolveHandle: (name: string) => Promise<string>,
|
resolveHandle: (name: string) => Promise<string>,
|
||||||
) {
|
) {
|
||||||
|
// TODO: remove this when the test suite no longer relies on it
|
||||||
if (IS_LOCAL_DEV(serviceUrl)) {
|
if (IS_LOCAL_DEV(serviceUrl)) {
|
||||||
// local dev
|
// local dev
|
||||||
const aliceDid = await resolveHandle('alice.test')
|
const aliceDid = await resolveHandle('alice.test')
|
||||||
|
@ -106,16 +107,8 @@ export async function DEFAULT_FEEDS(
|
||||||
} else {
|
} else {
|
||||||
// production
|
// production
|
||||||
return {
|
return {
|
||||||
pinned: [
|
pinned: [PROD_DEFAULT_FEED('whats-hot')],
|
||||||
PROD_DEFAULT_FEED('whats-hot'),
|
saved: [PROD_DEFAULT_FEED('whats-hot')],
|
||||||
PROD_DEFAULT_FEED('with-friends'),
|
|
||||||
],
|
|
||||||
saved: [
|
|
||||||
PROD_DEFAULT_FEED('bsky-team'),
|
|
||||||
PROD_DEFAULT_FEED('with-friends'),
|
|
||||||
PROD_DEFAULT_FEED('whats-hot'),
|
|
||||||
PROD_DEFAULT_FEED('hot-classic'),
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,7 @@ export class OnboardingModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
finish() {
|
finish() {
|
||||||
|
this.rootStore.me.mainFeed.refresh() // load the selected content
|
||||||
this.step = 'Home'
|
this.step = 'Home'
|
||||||
track('Onboarding:Complete')
|
track('Onboarding:Complete')
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,6 +116,10 @@ export class PostsFeedModel {
|
||||||
return this.hasLoaded && !this.hasContent
|
return this.hasLoaded && !this.hasContent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isLoadingMore() {
|
||||||
|
return this.isLoading && !this.isRefreshing
|
||||||
|
}
|
||||||
|
|
||||||
setHasNewLatest(v: boolean) {
|
setHasNewLatest(v: boolean) {
|
||||||
this.hasNewLatest = v
|
this.hasNewLatest = v
|
||||||
}
|
}
|
||||||
|
@ -307,7 +311,7 @@ export class PostsFeedModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
async _appendAll(res: FeedAPIResponse, replace = false) {
|
async _appendAll(res: FeedAPIResponse, replace = false) {
|
||||||
this.hasMore = !!res.cursor
|
this.hasMore = !!res.cursor && res.feed.length > 0
|
||||||
if (replace) {
|
if (replace) {
|
||||||
this.emptyFetches = 0
|
this.emptyFetches = 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -418,6 +418,7 @@ export class PreferencesModel {
|
||||||
const oldPinned = this.pinnedFeeds
|
const oldPinned = this.pinnedFeeds
|
||||||
this.savedFeeds = saved
|
this.savedFeeds = saved
|
||||||
this.pinnedFeeds = pinned
|
this.pinnedFeeds = pinned
|
||||||
|
await this.lock.acquireAsync()
|
||||||
try {
|
try {
|
||||||
const res = await cb()
|
const res = await cb()
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
|
@ -430,6 +431,8 @@ export class PreferencesModel {
|
||||||
this.pinnedFeeds = oldPinned
|
this.pinnedFeeds = oldPinned
|
||||||
})
|
})
|
||||||
throw e
|
throw e
|
||||||
|
} finally {
|
||||||
|
this.lock.release()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,7 +444,7 @@ export class PreferencesModel {
|
||||||
|
|
||||||
async addSavedFeed(v: string) {
|
async addSavedFeed(v: string) {
|
||||||
return this._optimisticUpdateSavedFeeds(
|
return this._optimisticUpdateSavedFeeds(
|
||||||
[...this.savedFeeds, v],
|
[...this.savedFeeds.filter(uri => uri !== v), v],
|
||||||
this.pinnedFeeds,
|
this.pinnedFeeds,
|
||||||
() => this.rootStore.agent.addSavedFeed(v),
|
() => this.rootStore.agent.addSavedFeed(v),
|
||||||
)
|
)
|
||||||
|
@ -457,8 +460,8 @@ export class PreferencesModel {
|
||||||
|
|
||||||
async addPinnedFeed(v: string) {
|
async addPinnedFeed(v: string) {
|
||||||
return this._optimisticUpdateSavedFeeds(
|
return this._optimisticUpdateSavedFeeds(
|
||||||
this.savedFeeds,
|
[...this.savedFeeds.filter(uri => uri !== v), v],
|
||||||
[...this.pinnedFeeds, v],
|
[...this.pinnedFeeds.filter(uri => uri !== v), v],
|
||||||
() => this.rootStore.agent.addPinnedFeed(v),
|
() => this.rootStore.agent.addPinnedFeed(v),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -473,71 +476,121 @@ export class PreferencesModel {
|
||||||
|
|
||||||
async setBirthDate(birthDate: Date) {
|
async setBirthDate(birthDate: Date) {
|
||||||
this.birthDate = birthDate
|
this.birthDate = birthDate
|
||||||
|
await this.lock.acquireAsync()
|
||||||
|
try {
|
||||||
await this.rootStore.agent.setPersonalDetails({birthDate})
|
await this.rootStore.agent.setPersonalDetails({birthDate})
|
||||||
|
} finally {
|
||||||
|
this.lock.release()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async toggleHomeFeedHideReplies() {
|
async toggleHomeFeedHideReplies() {
|
||||||
this.homeFeed.hideReplies = !this.homeFeed.hideReplies
|
this.homeFeed.hideReplies = !this.homeFeed.hideReplies
|
||||||
|
await this.lock.acquireAsync()
|
||||||
|
try {
|
||||||
await this.rootStore.agent.setFeedViewPrefs('home', {
|
await this.rootStore.agent.setFeedViewPrefs('home', {
|
||||||
hideReplies: this.homeFeed.hideReplies,
|
hideReplies: this.homeFeed.hideReplies,
|
||||||
})
|
})
|
||||||
|
} finally {
|
||||||
|
this.lock.release()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async toggleHomeFeedHideRepliesByUnfollowed() {
|
async toggleHomeFeedHideRepliesByUnfollowed() {
|
||||||
this.homeFeed.hideRepliesByUnfollowed =
|
this.homeFeed.hideRepliesByUnfollowed =
|
||||||
!this.homeFeed.hideRepliesByUnfollowed
|
!this.homeFeed.hideRepliesByUnfollowed
|
||||||
|
await this.lock.acquireAsync()
|
||||||
|
try {
|
||||||
await this.rootStore.agent.setFeedViewPrefs('home', {
|
await this.rootStore.agent.setFeedViewPrefs('home', {
|
||||||
hideRepliesByUnfollowed: this.homeFeed.hideRepliesByUnfollowed,
|
hideRepliesByUnfollowed: this.homeFeed.hideRepliesByUnfollowed,
|
||||||
})
|
})
|
||||||
|
} finally {
|
||||||
|
this.lock.release()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async setHomeFeedHideRepliesByLikeCount(threshold: number) {
|
async setHomeFeedHideRepliesByLikeCount(threshold: number) {
|
||||||
this.homeFeed.hideRepliesByLikeCount = threshold
|
this.homeFeed.hideRepliesByLikeCount = threshold
|
||||||
|
await this.lock.acquireAsync()
|
||||||
|
try {
|
||||||
await this.rootStore.agent.setFeedViewPrefs('home', {
|
await this.rootStore.agent.setFeedViewPrefs('home', {
|
||||||
hideRepliesByLikeCount: this.homeFeed.hideRepliesByLikeCount,
|
hideRepliesByLikeCount: this.homeFeed.hideRepliesByLikeCount,
|
||||||
})
|
})
|
||||||
|
} finally {
|
||||||
|
this.lock.release()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async toggleHomeFeedHideReposts() {
|
async toggleHomeFeedHideReposts() {
|
||||||
this.homeFeed.hideReposts = !this.homeFeed.hideReposts
|
this.homeFeed.hideReposts = !this.homeFeed.hideReposts
|
||||||
|
await this.lock.acquireAsync()
|
||||||
|
try {
|
||||||
await this.rootStore.agent.setFeedViewPrefs('home', {
|
await this.rootStore.agent.setFeedViewPrefs('home', {
|
||||||
hideReposts: this.homeFeed.hideReposts,
|
hideReposts: this.homeFeed.hideReposts,
|
||||||
})
|
})
|
||||||
|
} finally {
|
||||||
|
this.lock.release()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async toggleHomeFeedHideQuotePosts() {
|
async toggleHomeFeedHideQuotePosts() {
|
||||||
this.homeFeed.hideQuotePosts = !this.homeFeed.hideQuotePosts
|
this.homeFeed.hideQuotePosts = !this.homeFeed.hideQuotePosts
|
||||||
|
await this.lock.acquireAsync()
|
||||||
|
try {
|
||||||
await this.rootStore.agent.setFeedViewPrefs('home', {
|
await this.rootStore.agent.setFeedViewPrefs('home', {
|
||||||
hideQuotePosts: this.homeFeed.hideQuotePosts,
|
hideQuotePosts: this.homeFeed.hideQuotePosts,
|
||||||
})
|
})
|
||||||
|
} finally {
|
||||||
|
this.lock.release()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async toggleHomeFeedMergeFeedEnabled() {
|
async toggleHomeFeedMergeFeedEnabled() {
|
||||||
this.homeFeed.lab_mergeFeedEnabled = !this.homeFeed.lab_mergeFeedEnabled
|
this.homeFeed.lab_mergeFeedEnabled = !this.homeFeed.lab_mergeFeedEnabled
|
||||||
|
await this.lock.acquireAsync()
|
||||||
|
try {
|
||||||
await this.rootStore.agent.setFeedViewPrefs('home', {
|
await this.rootStore.agent.setFeedViewPrefs('home', {
|
||||||
lab_mergeFeedEnabled: this.homeFeed.lab_mergeFeedEnabled,
|
lab_mergeFeedEnabled: this.homeFeed.lab_mergeFeedEnabled,
|
||||||
})
|
})
|
||||||
|
} finally {
|
||||||
|
this.lock.release()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async setThreadSort(v: string) {
|
async setThreadSort(v: string) {
|
||||||
if (THREAD_SORT_VALUES.includes(v)) {
|
if (THREAD_SORT_VALUES.includes(v)) {
|
||||||
this.thread.sort = v
|
this.thread.sort = v
|
||||||
|
await this.lock.acquireAsync()
|
||||||
|
try {
|
||||||
await this.rootStore.agent.setThreadViewPrefs({sort: v})
|
await this.rootStore.agent.setThreadViewPrefs({sort: v})
|
||||||
|
} finally {
|
||||||
|
this.lock.release()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async togglePrioritizedFollowedUsers() {
|
async togglePrioritizedFollowedUsers() {
|
||||||
this.thread.prioritizeFollowedUsers = !this.thread.prioritizeFollowedUsers
|
this.thread.prioritizeFollowedUsers = !this.thread.prioritizeFollowedUsers
|
||||||
|
await this.lock.acquireAsync()
|
||||||
|
try {
|
||||||
await this.rootStore.agent.setThreadViewPrefs({
|
await this.rootStore.agent.setThreadViewPrefs({
|
||||||
prioritizeFollowedUsers: this.thread.prioritizeFollowedUsers,
|
prioritizeFollowedUsers: this.thread.prioritizeFollowedUsers,
|
||||||
})
|
})
|
||||||
|
} finally {
|
||||||
|
this.lock.release()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async toggleThreadTreeViewEnabled() {
|
async toggleThreadTreeViewEnabled() {
|
||||||
this.thread.lab_treeViewEnabled = !this.thread.lab_treeViewEnabled
|
this.thread.lab_treeViewEnabled = !this.thread.lab_treeViewEnabled
|
||||||
|
await this.lock.acquireAsync()
|
||||||
|
try {
|
||||||
await this.rootStore.agent.setThreadViewPrefs({
|
await this.rootStore.agent.setThreadViewPrefs({
|
||||||
lab_treeViewEnabled: this.thread.lab_treeViewEnabled,
|
lab_treeViewEnabled: this.thread.lab_treeViewEnabled,
|
||||||
})
|
})
|
||||||
|
} finally {
|
||||||
|
this.lock.release()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleRequireAltTextEnabled() {
|
toggleRequireAltTextEnabled() {
|
||||||
|
|
|
@ -6,10 +6,6 @@ import {toHashCode} from 'lib/strings/helpers'
|
||||||
const DAY = 60e3 * 24 * 1 // 1 day (ms)
|
const DAY = 60e3 * 24 * 1 // 1 day (ms)
|
||||||
|
|
||||||
export class Reminders {
|
export class Reminders {
|
||||||
// NOTE
|
|
||||||
// by defaulting to the current date, we ensure that the user won't be nagged
|
|
||||||
// on first run (aka right after creating an account)
|
|
||||||
// -prf
|
|
||||||
lastEmailConfirm: Date = new Date()
|
lastEmailConfirm: Date = new Date()
|
||||||
|
|
||||||
constructor(public rootStore: RootStoreModel) {
|
constructor(public rootStore: RootStoreModel) {
|
||||||
|
@ -46,6 +42,9 @@ export class Reminders {
|
||||||
if (sess.emailConfirmed) {
|
if (sess.emailConfirmed) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if (this.rootStore.onboarding.isActive) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
const today = new Date()
|
const today = new Date()
|
||||||
// shard the users into 2 day of the week buckets
|
// shard the users into 2 day of the week buckets
|
||||||
// (this is to avoid a sudden influx of email updates when
|
// (this is to avoid a sudden influx of email updates when
|
||||||
|
|
|
@ -30,7 +30,6 @@ export const RecommendedFeedsItem = observer(function RecommendedFeedsItemImpl({
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
await item.save()
|
|
||||||
await item.pin()
|
await item.pin()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Toast.show('There was an issue contacting your server')
|
Toast.show('There was an issue contacting your server')
|
||||||
|
|
|
@ -33,6 +33,7 @@ export const Feed = observer(function Feed({
|
||||||
onScroll,
|
onScroll,
|
||||||
scrollEventThrottle,
|
scrollEventThrottle,
|
||||||
renderEmptyState,
|
renderEmptyState,
|
||||||
|
renderEndOfFeed,
|
||||||
testID,
|
testID,
|
||||||
headerOffset = 0,
|
headerOffset = 0,
|
||||||
ListHeaderComponent,
|
ListHeaderComponent,
|
||||||
|
@ -45,6 +46,7 @@ export const Feed = observer(function Feed({
|
||||||
onScroll?: OnScrollCb
|
onScroll?: OnScrollCb
|
||||||
scrollEventThrottle?: number
|
scrollEventThrottle?: number
|
||||||
renderEmptyState?: () => JSX.Element
|
renderEmptyState?: () => JSX.Element
|
||||||
|
renderEndOfFeed?: () => JSX.Element
|
||||||
testID?: string
|
testID?: string
|
||||||
headerOffset?: number
|
headerOffset?: number
|
||||||
ListHeaderComponent?: () => JSX.Element
|
ListHeaderComponent?: () => JSX.Element
|
||||||
|
@ -142,14 +144,16 @@ export const Feed = observer(function Feed({
|
||||||
|
|
||||||
const FeedFooter = React.useCallback(
|
const FeedFooter = React.useCallback(
|
||||||
() =>
|
() =>
|
||||||
feed.isLoading ? (
|
feed.isLoadingMore ? (
|
||||||
<View style={styles.feedFooter}>
|
<View style={styles.feedFooter}>
|
||||||
<ActivityIndicator />
|
<ActivityIndicator />
|
||||||
</View>
|
</View>
|
||||||
|
) : !feed.hasMore && !feed.isEmpty && renderEndOfFeed ? (
|
||||||
|
renderEndOfFeed()
|
||||||
) : (
|
) : (
|
||||||
<View />
|
<View />
|
||||||
),
|
),
|
||||||
[feed],
|
[feed.isLoadingMore, feed.hasMore, feed.isEmpty, renderEndOfFeed],
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -28,16 +28,23 @@ export function FollowingEmptyState() {
|
||||||
}, [navigation])
|
}, [navigation])
|
||||||
|
|
||||||
const onPressDiscoverFeeds = React.useCallback(() => {
|
const onPressDiscoverFeeds = React.useCallback(() => {
|
||||||
|
if (isWeb) {
|
||||||
navigation.navigate('Feeds')
|
navigation.navigate('Feeds')
|
||||||
|
} else {
|
||||||
|
navigation.navigate('FeedsTab')
|
||||||
|
navigation.popToTop()
|
||||||
|
}
|
||||||
}, [navigation])
|
}, [navigation])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.emptyContainer}>
|
<View style={styles.container}>
|
||||||
<View style={styles.emptyIconContainer}>
|
<View style={styles.inner}>
|
||||||
<MagnifyingGlassIcon style={[styles.emptyIcon, pal.text]} size={62} />
|
<View style={styles.iconContainer}>
|
||||||
|
<MagnifyingGlassIcon style={[styles.icon, pal.text]} size={62} />
|
||||||
</View>
|
</View>
|
||||||
<Text type="xl-medium" style={[s.textCenter, pal.text]}>
|
<Text type="xl-medium" style={[s.textCenter, pal.text]}>
|
||||||
Your following feed is empty! Find some accounts to follow to fix this.
|
Your following feed is empty! Follow more users to see what's
|
||||||
|
happening.
|
||||||
</Text>
|
</Text>
|
||||||
<Button
|
<Button
|
||||||
type="inverted"
|
type="inverted"
|
||||||
|
@ -70,18 +77,24 @@ export function FollowingEmptyState() {
|
||||||
/>
|
/>
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
emptyContainer: {
|
container: {
|
||||||
height: '100%',
|
height: '100%',
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'center',
|
||||||
paddingVertical: 40,
|
paddingVertical: 40,
|
||||||
paddingHorizontal: 30,
|
paddingHorizontal: 30,
|
||||||
},
|
},
|
||||||
emptyIconContainer: {
|
inner: {
|
||||||
|
maxWidth: 460,
|
||||||
|
},
|
||||||
|
iconContainer: {
|
||||||
marginBottom: 16,
|
marginBottom: 16,
|
||||||
},
|
},
|
||||||
emptyIcon: {
|
icon: {
|
||||||
marginLeft: 'auto',
|
marginLeft: 'auto',
|
||||||
marginRight: 'auto',
|
marginRight: 'auto',
|
||||||
},
|
},
|
||||||
|
@ -94,13 +107,4 @@ const styles = StyleSheet.create({
|
||||||
paddingHorizontal: 24,
|
paddingHorizontal: 24,
|
||||||
borderRadius: 30,
|
borderRadius: 30,
|
||||||
},
|
},
|
||||||
|
|
||||||
feedsTip: {
|
|
||||||
position: 'absolute',
|
|
||||||
left: 22,
|
|
||||||
},
|
|
||||||
feedsTipArrow: {
|
|
||||||
marginLeft: 32,
|
|
||||||
marginTop: 8,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,100 @@
|
||||||
|
import React from 'react'
|
||||||
|
import {StyleSheet, View} from 'react-native'
|
||||||
|
import {useNavigation} from '@react-navigation/native'
|
||||||
|
import {
|
||||||
|
FontAwesomeIcon,
|
||||||
|
FontAwesomeIconStyle,
|
||||||
|
} from '@fortawesome/react-native-fontawesome'
|
||||||
|
import {Text} from '../util/text/Text'
|
||||||
|
import {Button} from '../util/forms/Button'
|
||||||
|
import {NavigationProp} from 'lib/routes/types'
|
||||||
|
import {usePalette} from 'lib/hooks/usePalette'
|
||||||
|
import {s} from 'lib/styles'
|
||||||
|
import {isWeb} from 'platform/detection'
|
||||||
|
|
||||||
|
export function FollowingEndOfFeed() {
|
||||||
|
const pal = usePalette('default')
|
||||||
|
const palInverted = usePalette('inverted')
|
||||||
|
const navigation = useNavigation<NavigationProp>()
|
||||||
|
|
||||||
|
const onPressFindAccounts = React.useCallback(() => {
|
||||||
|
if (isWeb) {
|
||||||
|
navigation.navigate('Search', {})
|
||||||
|
} else {
|
||||||
|
navigation.navigate('SearchTab')
|
||||||
|
navigation.popToTop()
|
||||||
|
}
|
||||||
|
}, [navigation])
|
||||||
|
|
||||||
|
const onPressDiscoverFeeds = React.useCallback(() => {
|
||||||
|
if (isWeb) {
|
||||||
|
navigation.navigate('Feeds')
|
||||||
|
} else {
|
||||||
|
navigation.navigate('FeedsTab')
|
||||||
|
navigation.popToTop()
|
||||||
|
}
|
||||||
|
}, [navigation])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={[styles.container, pal.border]}>
|
||||||
|
<View style={styles.inner}>
|
||||||
|
<Text type="xl-medium" style={[s.textCenter, pal.text]}>
|
||||||
|
You've reached the end of your feed! Find some more accounts to
|
||||||
|
follow.
|
||||||
|
</Text>
|
||||||
|
<Button
|
||||||
|
type="inverted"
|
||||||
|
style={styles.emptyBtn}
|
||||||
|
onPress={onPressFindAccounts}>
|
||||||
|
<Text type="lg-medium" style={palInverted.text}>
|
||||||
|
Find accounts to follow
|
||||||
|
</Text>
|
||||||
|
<FontAwesomeIcon
|
||||||
|
icon="angle-right"
|
||||||
|
style={palInverted.text as FontAwesomeIconStyle}
|
||||||
|
size={14}
|
||||||
|
/>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Text type="xl-medium" style={[s.textCenter, pal.text, s.mt20]}>
|
||||||
|
You can also discover new Custom Feeds to follow.
|
||||||
|
</Text>
|
||||||
|
<Button
|
||||||
|
type="inverted"
|
||||||
|
style={[styles.emptyBtn, s.mt10]}
|
||||||
|
onPress={onPressDiscoverFeeds}>
|
||||||
|
<Text type="lg-medium" style={palInverted.text}>
|
||||||
|
Discover new custom feeds
|
||||||
|
</Text>
|
||||||
|
<FontAwesomeIcon
|
||||||
|
icon="angle-right"
|
||||||
|
style={palInverted.text as FontAwesomeIconStyle}
|
||||||
|
size={14}
|
||||||
|
/>
|
||||||
|
</Button>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
justifyContent: 'center',
|
||||||
|
paddingTop: 40,
|
||||||
|
paddingBottom: 80,
|
||||||
|
paddingHorizontal: 30,
|
||||||
|
borderTopWidth: 1,
|
||||||
|
},
|
||||||
|
inner: {
|
||||||
|
maxWidth: 460,
|
||||||
|
},
|
||||||
|
emptyBtn: {
|
||||||
|
marginVertical: 20,
|
||||||
|
flexDirection: 'row',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
paddingVertical: 18,
|
||||||
|
paddingHorizontal: 24,
|
||||||
|
borderRadius: 30,
|
||||||
|
},
|
||||||
|
})
|
|
@ -93,7 +93,7 @@ export function HeaderWithInput({
|
||||||
onBlur={() => setIsInputFocused(false)}
|
onBlur={() => setIsInputFocused(false)}
|
||||||
onChangeText={onChangeQuery}
|
onChangeText={onChangeQuery}
|
||||||
onSubmitEditing={onSubmitQuery}
|
onSubmitEditing={onSubmitQuery}
|
||||||
autoFocus={isMobile}
|
autoFocus={false}
|
||||||
accessibilityRole="search"
|
accessibilityRole="search"
|
||||||
accessibilityLabel="Search"
|
accessibilityLabel="Search"
|
||||||
accessibilityHint=""
|
accessibilityHint=""
|
||||||
|
|
|
@ -28,7 +28,7 @@ export class ErrorBoundary extends Component<Props, State> {
|
||||||
public render() {
|
public render() {
|
||||||
if (this.state.hasError) {
|
if (this.state.hasError) {
|
||||||
return (
|
return (
|
||||||
<CenteredView>
|
<CenteredView style={{height: '100%', flex: 1}}>
|
||||||
<ErrorScreen
|
<ErrorScreen
|
||||||
title="Oh no!"
|
title="Oh no!"
|
||||||
message="There was an unexpected issue in the application. Please let us know if this happened to you!"
|
message="There was an unexpected issue in the application. Please let us know if this happened to you!"
|
||||||
|
|
|
@ -13,6 +13,7 @@ import {withAuthRequired} from 'view/com/auth/withAuthRequired'
|
||||||
import {TextLink} from 'view/com/util/Link'
|
import {TextLink} from 'view/com/util/Link'
|
||||||
import {Feed} from '../com/posts/Feed'
|
import {Feed} from '../com/posts/Feed'
|
||||||
import {FollowingEmptyState} from 'view/com/posts/FollowingEmptyState'
|
import {FollowingEmptyState} from 'view/com/posts/FollowingEmptyState'
|
||||||
|
import {FollowingEndOfFeed} from 'view/com/posts/FollowingEndOfFeed'
|
||||||
import {CustomFeedEmptyState} from 'view/com/posts/CustomFeedEmptyState'
|
import {CustomFeedEmptyState} from 'view/com/posts/CustomFeedEmptyState'
|
||||||
import {LoadLatestBtn} from '../com/util/load-latest/LoadLatestBtn'
|
import {LoadLatestBtn} from '../com/util/load-latest/LoadLatestBtn'
|
||||||
import {FeedsTabBar} from '../com/pager/FeedsTabBar'
|
import {FeedsTabBar} from '../com/pager/FeedsTabBar'
|
||||||
|
@ -110,6 +111,10 @@ export const HomeScreen = withAuthRequired(
|
||||||
return <FollowingEmptyState />
|
return <FollowingEmptyState />
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
const renderFollowingEndOfFeed = React.useCallback(() => {
|
||||||
|
return <FollowingEndOfFeed />
|
||||||
|
}, [])
|
||||||
|
|
||||||
const renderCustomFeedEmptyState = React.useCallback(() => {
|
const renderCustomFeedEmptyState = React.useCallback(() => {
|
||||||
return <CustomFeedEmptyState />
|
return <CustomFeedEmptyState />
|
||||||
}, [])
|
}, [])
|
||||||
|
@ -127,6 +132,7 @@ export const HomeScreen = withAuthRequired(
|
||||||
isPageFocused={selectedPage === 0}
|
isPageFocused={selectedPage === 0}
|
||||||
feed={store.me.mainFeed}
|
feed={store.me.mainFeed}
|
||||||
renderEmptyState={renderFollowingEmptyState}
|
renderEmptyState={renderFollowingEmptyState}
|
||||||
|
renderEndOfFeed={renderFollowingEndOfFeed}
|
||||||
/>
|
/>
|
||||||
{customFeeds.map((f, index) => {
|
{customFeeds.map((f, index) => {
|
||||||
return (
|
return (
|
||||||
|
@ -149,11 +155,13 @@ const FeedPage = observer(function FeedPageImpl({
|
||||||
isPageFocused,
|
isPageFocused,
|
||||||
feed,
|
feed,
|
||||||
renderEmptyState,
|
renderEmptyState,
|
||||||
|
renderEndOfFeed,
|
||||||
}: {
|
}: {
|
||||||
testID?: string
|
testID?: string
|
||||||
feed: PostsFeedModel
|
feed: PostsFeedModel
|
||||||
isPageFocused: boolean
|
isPageFocused: boolean
|
||||||
renderEmptyState?: () => JSX.Element
|
renderEmptyState?: () => JSX.Element
|
||||||
|
renderEndOfFeed?: () => JSX.Element
|
||||||
}) {
|
}) {
|
||||||
const store = useStores()
|
const store = useStores()
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
|
@ -307,6 +315,7 @@ const FeedPage = observer(function FeedPageImpl({
|
||||||
onScroll={onMainScroll}
|
onScroll={onMainScroll}
|
||||||
scrollEventThrottle={100}
|
scrollEventThrottle={100}
|
||||||
renderEmptyState={renderEmptyState}
|
renderEmptyState={renderEmptyState}
|
||||||
|
renderEndOfFeed={renderEndOfFeed}
|
||||||
ListHeaderComponent={ListHeaderComponent}
|
ListHeaderComponent={ListHeaderComponent}
|
||||||
headerOffset={headerOffset}
|
headerOffset={headerOffset}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue