From d7e39bde12e05ccc31b2cdbdfa214c0a8e08fc54 Mon Sep 17 00:00:00 2001 From: Ansh Nanda Date: Mon, 15 May 2023 11:00:54 -0700 Subject: [PATCH] saved feeds in tab bar --- src/state/models/feeds/algo/saved.ts | 10 ++++++ src/view/com/pager/FeedsTabBarMobile.tsx | 6 +++- src/view/com/pager/TabBar.tsx | 43 +++++++++++++----------- src/view/screens/Home.tsx | 11 ++++++ 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 86b97cf6..bc36aaed 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 725c4460..c3c44255 100644 --- a/src/view/com/pager/FeedsTabBarMobile.tsx +++ b/src/view/com/pager/FeedsTabBarMobile.tsx @@ -45,7 +45,11 @@ export const FeedsTabBar = observer( diff --git a/src/view/com/pager/TabBar.tsx b/src/view/com/pager/TabBar.tsx index 628128e8..5d2e18e3 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}> - {items.map((item, i) => { - const selected = i === selectedPage - return ( - onPressItem(i)}> - - {item} - - - ) - })} + + {items.map((item, i) => { + const selected = i === selectedPage + return ( + onPressItem(i)}> + + {item} + + + ) + })} + ) } diff --git a/src/view/screens/Home.tsx b/src/view/screens/Home.tsx index 18e4f250..4806ed97 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 ( + + ) + })} ) }), diff --git a/src/view/screens/Settings.tsx b/src/view/screens/Settings.tsx index fd8fb4f4..0c8ac3f1 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">