saved feeds in tab bar

zio/stable
Ansh Nanda 2023-05-15 11:00:54 -07:00
parent 5010861160
commit d7e39bde12
5 changed files with 50 additions and 22 deletions

View File

@ -41,6 +41,16 @@ export class SavedFeedsModel {
return this.hasLoaded && !this.hasContent return this.hasLoaded && !this.hasContent
} }
get numOfFeeds() {
return this.feeds.length
}
get listOfFeedNames() {
return this.feeds.map(
f => f.data.displayName ?? f.data.creator.displayName + "'s feed",
)
}
// public api // public api
// = // =

View File

@ -45,7 +45,11 @@ export const FeedsTabBar = observer(
</TouchableOpacity> </TouchableOpacity>
<TabBar <TabBar
{...props} {...props}
items={['Following', "What's hot"]} items={[
'Following',
"What's hot",
...store.me.savedFeeds.listOfFeedNames,
]}
indicatorPosition="bottom" indicatorPosition="bottom"
indicatorColor={pal.colors.link} indicatorColor={pal.colors.link}
/> />

View File

@ -4,6 +4,7 @@ import {Text} from '../util/text/Text'
import {PressableWithHover} from '../util/PressableWithHover' import {PressableWithHover} from '../util/PressableWithHover'
import {usePalette} from 'lib/hooks/usePalette' import {usePalette} from 'lib/hooks/usePalette'
import {isDesktopWeb} from 'platform/detection' import {isDesktopWeb} from 'platform/detection'
import {ScrollView} from 'react-native-gesture-handler'
interface Layout { interface Layout {
x: number x: number
@ -102,26 +103,28 @@ export function TabBar({
onLayout={onLayout} onLayout={onLayout}
ref={containerRef}> ref={containerRef}>
<Animated.View style={[styles.indicator, indicatorStyle]} /> <Animated.View style={[styles.indicator, indicatorStyle]} />
{items.map((item, i) => { <ScrollView horizontal={true} showsHorizontalScrollIndicator={false}>
const selected = i === selectedPage {items.map((item, i) => {
return ( const selected = i === selectedPage
<PressableWithHover return (
ref={itemRefs[i]} <PressableWithHover
key={item} ref={itemRefs[i]}
style={ key={item}
indicatorPosition === 'top' ? styles.itemTop : styles.itemBottom style={
} indicatorPosition === 'top' ? styles.itemTop : styles.itemBottom
hoverStyle={pal.viewLight} }
onPress={() => onPressItem(i)}> hoverStyle={pal.viewLight}
<Text onPress={() => onPressItem(i)}>
type="xl-bold" <Text
testID={testID ? `${testID}-${item}` : undefined} type="xl-bold"
style={selected ? pal.text : pal.textLight}> testID={testID ? `${testID}-${item}` : undefined}
{item} style={selected ? pal.text : pal.textLight}>
</Text> {item}
</PressableWithHover> </Text>
) </PressableWithHover>
})} )
})}
</ScrollView>
</View> </View>
) )
} }

View File

@ -112,6 +112,17 @@ export const HomeScreen = withAuthRequired(
feed={algoFeed} feed={algoFeed}
renderEmptyState={renderWhatsHotEmptyState} renderEmptyState={renderWhatsHotEmptyState}
/> />
{store.me.savedFeeds.feeds.map((f, index) => {
return (
<FeedPage
key={String(2 + index + 1)}
testID="customFeed"
isPageFocused={selectedPage === 2 + index}
feed={new PostsFeedModel(store, 'custom', {feed: f.getUri})}
renderEmptyState={renderFollowingEmptyState}
/>
)
})}
</Pager> </Pager>
) )
}), }),

View File

@ -295,7 +295,7 @@ export const SettingsScreen = withAuthRequired(
style={[styles.linkCard, pal.view, isSwitching && styles.dimmed]} style={[styles.linkCard, pal.view, isSwitching && styles.dimmed]}
accessibilityHint="Custom Algorithms" accessibilityHint="Custom Algorithms"
accessibilityLabel="Opens screen with all bookmarked custom algorithms" accessibilityLabel="Opens screen with all bookmarked custom algorithms"
href="/settings/custom-algorithms"> href="/settings/saved-feeds">
<View style={[styles.iconContainer, pal.btn]}> <View style={[styles.iconContainer, pal.btn]}>
<FontAwesomeIcon <FontAwesomeIcon
icon="rss" icon="rss"