* 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 copy
100 lines
2.7 KiB
TypeScript
100 lines
2.7 KiB
TypeScript
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,
|
|
},
|
|
})
|