From 61ea37ff818ca64cec8e10b3a423ecd22dcf0141 Mon Sep 17 00:00:00 2001 From: Ansh Nanda Date: Sun, 14 May 2023 18:37:18 -0700 Subject: renamed page to savedfeeds --- src/Navigation.tsx | 4 +- src/lib/routes/types.ts | 2 +- src/routes.ts | 2 +- src/view/screens/CustomAlgorithms.tsx | 105 ---------------------------------- src/view/screens/SavedFeeds.tsx | 103 +++++++++++++++++++++++++++++++++ 5 files changed, 107 insertions(+), 109 deletions(-) delete mode 100644 src/view/screens/CustomAlgorithms.tsx create mode 100644 src/view/screens/SavedFeeds.tsx (limited to 'src') diff --git a/src/Navigation.tsx b/src/Navigation.tsx index 8b6e1b453..26dc9f7ad 100644 --- a/src/Navigation.tsx +++ b/src/Navigation.tsx @@ -52,7 +52,7 @@ import {AppPasswords} from 'view/screens/AppPasswords' import {MutedAccounts} from 'view/screens/MutedAccounts' import {BlockedAccounts} from 'view/screens/BlockedAccounts' import {getRoutingInstrumentation} from 'lib/sentry' -import CustomAlgorithms from 'view/screens/CustomAlgorithms' +import {SavedFeeds} from './view/screens/SavedFeeds' const navigationRef = createNavigationContainerRef() @@ -92,7 +92,7 @@ function commonScreens(Stack: typeof HomeTab) { /> - + diff --git a/src/lib/routes/types.ts b/src/lib/routes/types.ts index b91495640..5a4126f6a 100644 --- a/src/lib/routes/types.ts +++ b/src/lib/routes/types.ts @@ -20,7 +20,7 @@ export type CommonNavigatorParams = { CommunityGuidelines: undefined CopyrightPolicy: undefined AppPasswords: undefined - CustomAlgorithms: undefined + SavedFeeds: undefined MutedAccounts: undefined BlockedAccounts: undefined } diff --git a/src/routes.ts b/src/routes.ts index c1b441984..b510f66f6 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -14,7 +14,7 @@ export const router = new Router({ Debug: '/sys/debug', Log: '/sys/log', AppPasswords: '/settings/app-passwords', - CustomAlgorithms: '/settings/custom-algorithms', + SavedFeeds: '/settings/saved-feeds', MutedAccounts: '/settings/muted-accounts', BlockedAccounts: '/settings/blocked-accounts', Support: '/support', diff --git a/src/view/screens/CustomAlgorithms.tsx b/src/view/screens/CustomAlgorithms.tsx deleted file mode 100644 index b838660df..000000000 --- a/src/view/screens/CustomAlgorithms.tsx +++ /dev/null @@ -1,105 +0,0 @@ -import React, {useCallback, useMemo} from 'react' -import { - RefreshControl, - StyleSheet, - View, - FlatList, - ActivityIndicator, -} from 'react-native' -import {useFocusEffect} from '@react-navigation/native' -import {NativeStackScreenProps} from '@react-navigation/native-stack' -import {useAnalytics} from 'lib/analytics' -import {usePalette} from 'lib/hooks/usePalette' -import {CommonNavigatorParams} from 'lib/routes/types' -import {observer} from 'mobx-react-lite' -import {useStores} from 'state/index' -import {SavedFeedsModel} from 'state/models/feeds/algo/saved' -import AlgoItem from 'view/com/algos/AlgoItem' -import {withAuthRequired} from 'view/com/auth/withAuthRequired' -import {ViewHeader} from 'view/com/util/ViewHeader' -import {CenteredView} from 'view/com/util/Views' -import {Text} from 'view/com/util/text/Text' -import {isDesktopWeb} from 'platform/detection' -import {s} from 'lib/styles' - -type Props = NativeStackScreenProps - -const CustomAlgorithms = withAuthRequired( - observer(({}: Props) => { - const pal = usePalette('default') - const rootStore = useStores() - const {screen} = useAnalytics() - - const savedFeeds = useMemo( - () => new SavedFeedsModel(rootStore), - [rootStore], - ) - - useFocusEffect( - useCallback(() => { - screen('SavedFeeds') - rootStore.shell.setMinimalShellMode(false) - savedFeeds.refresh() - }, [screen, rootStore, savedFeeds]), - ) - - return ( - - - item.data.uri} - refreshControl={ - savedFeeds.refresh()} - tintColor={pal.colors.text} - titleColor={pal.colors.text} - /> - } - onEndReached={() => savedFeeds.loadMore()} - renderItem={({item}) => } - initialNumToRender={15} - ListFooterComponent={() => ( - - {savedFeeds.isLoading && } - - )} - ListEmptyComponent={() => ( - - - You don't have any saved feeds. To save a feed, click the save - button when a custom feed or algorithm shows up. - - - )} - extraData={savedFeeds.isLoading} - // @ts-ignore our .web version only -prf - desktopFixedHeight - /> - - ) - }), -) - -export default CustomAlgorithms - -const styles = StyleSheet.create({ - footer: { - paddingVertical: 20, - }, - empty: { - paddingHorizontal: 20, - paddingVertical: 20, - borderRadius: 16, - marginHorizontal: 24, - marginTop: 10, - }, -}) diff --git a/src/view/screens/SavedFeeds.tsx b/src/view/screens/SavedFeeds.tsx new file mode 100644 index 000000000..7b04a6474 --- /dev/null +++ b/src/view/screens/SavedFeeds.tsx @@ -0,0 +1,103 @@ +import React, {useCallback, useMemo} from 'react' +import { + RefreshControl, + StyleSheet, + View, + FlatList, + ActivityIndicator, +} from 'react-native' +import {useFocusEffect} from '@react-navigation/native' +import {NativeStackScreenProps} from '@react-navigation/native-stack' +import {useAnalytics} from 'lib/analytics' +import {usePalette} from 'lib/hooks/usePalette' +import {CommonNavigatorParams} from 'lib/routes/types' +import {observer} from 'mobx-react-lite' +import {useStores} from 'state/index' +import {SavedFeedsModel} from 'state/models/feeds/algo/saved' +import AlgoItem from 'view/com/algos/AlgoItem' +import {withAuthRequired} from 'view/com/auth/withAuthRequired' +import {ViewHeader} from 'view/com/util/ViewHeader' +import {CenteredView} from 'view/com/util/Views' +import {Text} from 'view/com/util/text/Text' +import {isDesktopWeb} from 'platform/detection' +import {s} from 'lib/styles' + +type Props = NativeStackScreenProps + +export const SavedFeeds = withAuthRequired( + observer(({}: Props) => { + const pal = usePalette('default') + const rootStore = useStores() + const {screen} = useAnalytics() + + const savedFeeds = useMemo( + () => new SavedFeedsModel(rootStore), + [rootStore], + ) + + useFocusEffect( + useCallback(() => { + screen('SavedFeeds') + rootStore.shell.setMinimalShellMode(false) + savedFeeds.refresh() + }, [screen, rootStore, savedFeeds]), + ) + + return ( + + + item.data.uri} + refreshControl={ + savedFeeds.refresh()} + tintColor={pal.colors.text} + titleColor={pal.colors.text} + /> + } + onEndReached={() => savedFeeds.loadMore()} + renderItem={({item}) => } + initialNumToRender={15} + ListFooterComponent={() => ( + + {savedFeeds.isLoading && } + + )} + ListEmptyComponent={() => ( + + + You don't have any saved feeds. To save a feed, click the save + button when a custom feed or algorithm shows up. + + + )} + extraData={savedFeeds.isLoading} + // @ts-ignore our .web version only -prf + desktopFixedHeight + /> + + ) + }), +) + +const styles = StyleSheet.create({ + footer: { + paddingVertical: 20, + }, + empty: { + paddingHorizontal: 20, + paddingVertical: 20, + borderRadius: 16, + marginHorizontal: 24, + marginTop: 10, + }, +}) -- cgit 1.4.1