saved feeds in tab bar
parent
5010861160
commit
d7e39bde12
|
@ -41,6 +41,16 @@ export class SavedFeedsModel {
|
|||
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
|
||||
// =
|
||||
|
||||
|
|
|
@ -45,7 +45,11 @@ export const FeedsTabBar = observer(
|
|||
</TouchableOpacity>
|
||||
<TabBar
|
||||
{...props}
|
||||
items={['Following', "What's hot"]}
|
||||
items={[
|
||||
'Following',
|
||||
"What's hot",
|
||||
...store.me.savedFeeds.listOfFeedNames,
|
||||
]}
|
||||
indicatorPosition="bottom"
|
||||
indicatorColor={pal.colors.link}
|
||||
/>
|
||||
|
|
|
@ -4,6 +4,7 @@ import {Text} from '../util/text/Text'
|
|||
import {PressableWithHover} from '../util/PressableWithHover'
|
||||
import {usePalette} from 'lib/hooks/usePalette'
|
||||
import {isDesktopWeb} from 'platform/detection'
|
||||
import {ScrollView} from 'react-native-gesture-handler'
|
||||
|
||||
interface Layout {
|
||||
x: number
|
||||
|
@ -102,26 +103,28 @@ export function TabBar({
|
|||
onLayout={onLayout}
|
||||
ref={containerRef}>
|
||||
<Animated.View style={[styles.indicator, indicatorStyle]} />
|
||||
{items.map((item, i) => {
|
||||
const selected = i === selectedPage
|
||||
return (
|
||||
<PressableWithHover
|
||||
ref={itemRefs[i]}
|
||||
key={item}
|
||||
style={
|
||||
indicatorPosition === 'top' ? styles.itemTop : styles.itemBottom
|
||||
}
|
||||
hoverStyle={pal.viewLight}
|
||||
onPress={() => onPressItem(i)}>
|
||||
<Text
|
||||
type="xl-bold"
|
||||
testID={testID ? `${testID}-${item}` : undefined}
|
||||
style={selected ? pal.text : pal.textLight}>
|
||||
{item}
|
||||
</Text>
|
||||
</PressableWithHover>
|
||||
)
|
||||
})}
|
||||
<ScrollView horizontal={true} showsHorizontalScrollIndicator={false}>
|
||||
{items.map((item, i) => {
|
||||
const selected = i === selectedPage
|
||||
return (
|
||||
<PressableWithHover
|
||||
ref={itemRefs[i]}
|
||||
key={item}
|
||||
style={
|
||||
indicatorPosition === 'top' ? styles.itemTop : styles.itemBottom
|
||||
}
|
||||
hoverStyle={pal.viewLight}
|
||||
onPress={() => onPressItem(i)}>
|
||||
<Text
|
||||
type="xl-bold"
|
||||
testID={testID ? `${testID}-${item}` : undefined}
|
||||
style={selected ? pal.text : pal.textLight}>
|
||||
{item}
|
||||
</Text>
|
||||
</PressableWithHover>
|
||||
)
|
||||
})}
|
||||
</ScrollView>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -112,6 +112,17 @@ export const HomeScreen = withAuthRequired(
|
|||
feed={algoFeed}
|
||||
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>
|
||||
)
|
||||
}),
|
||||
|
|
|
@ -295,7 +295,7 @@ export const SettingsScreen = withAuthRequired(
|
|||
style={[styles.linkCard, pal.view, isSwitching && styles.dimmed]}
|
||||
accessibilityHint="Custom Algorithms"
|
||||
accessibilityLabel="Opens screen with all bookmarked custom algorithms"
|
||||
href="/settings/custom-algorithms">
|
||||
href="/settings/saved-feeds">
|
||||
<View style={[styles.iconContainer, pal.btn]}>
|
||||
<FontAwesomeIcon
|
||||
icon="rss"
|
||||
|
|
Loading…
Reference in New Issue