diff options
author | Ansh Nanda <anshnanda10@gmail.com> | 2023-05-15 11:00:54 -0700 |
---|---|---|
committer | Ansh Nanda <anshnanda10@gmail.com> | 2023-05-15 11:00:54 -0700 |
commit | d7e39bde12e05ccc31b2cdbdfa214c0a8e08fc54 (patch) | |
tree | 5659ca119695974f492fac827993d2bb7256ebbd /src | |
parent | 50108611600ae2addb3bff4f00562b02f9c35fdf (diff) | |
download | voidsky-d7e39bde12e05ccc31b2cdbdfa214c0a8e08fc54.tar.zst |
saved feeds in tab bar
Diffstat (limited to 'src')
-rw-r--r-- | src/state/models/feeds/algo/saved.ts | 10 | ||||
-rw-r--r-- | src/view/com/pager/FeedsTabBarMobile.tsx | 6 | ||||
-rw-r--r-- | src/view/com/pager/TabBar.tsx | 43 | ||||
-rw-r--r-- | src/view/screens/Home.tsx | 11 | ||||
-rw-r--r-- | src/view/screens/Settings.tsx | 2 |
5 files changed, 50 insertions, 22 deletions
diff --git a/src/state/models/feeds/algo/saved.ts b/src/state/models/feeds/algo/saved.ts index 86b97cf67..bc36aaed8 100644 --- a/src/state/models/feeds/algo/saved.ts +++ b/src/state/models/feeds/algo/saved.ts @@ -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 // = diff --git a/src/view/com/pager/FeedsTabBarMobile.tsx b/src/view/com/pager/FeedsTabBarMobile.tsx index 725c44603..c3c442552 100644 --- a/src/view/com/pager/FeedsTabBarMobile.tsx +++ b/src/view/com/pager/FeedsTabBarMobile.tsx @@ -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} /> diff --git a/src/view/com/pager/TabBar.tsx b/src/view/com/pager/TabBar.tsx index 628128e8f..5d2e18e3e 100644 --- a/src/view/com/pager/TabBar.tsx +++ b/src/view/com/pager/TabBar.tsx @@ -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> ) } diff --git a/src/view/screens/Home.tsx b/src/view/screens/Home.tsx index 18e4f2506..4806ed97b 100644 --- a/src/view/screens/Home.tsx +++ b/src/view/screens/Home.tsx @@ -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> ) }), diff --git a/src/view/screens/Settings.tsx b/src/view/screens/Settings.tsx index fd8fb4f4a..0c8ac3f1f 100644 --- a/src/view/screens/Settings.tsx +++ b/src/view/screens/Settings.tsx @@ -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" |