From 6105314f15448a965ef93044c58ab50ff6616bb4 Mon Sep 17 00:00:00 2001 From: Ansh Nanda Date: Sun, 14 May 2023 15:38:38 -0700 Subject: add empty view to CustomAlgorithms screen --- src/view/com/algos/AlgoItem.tsx | 3 +- src/view/screens/CustomAlgorithms.tsx | 74 +++++++++++++++++++---------------- 2 files changed, 43 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/view/com/algos/AlgoItem.tsx b/src/view/com/algos/AlgoItem.tsx index 987bfd68d..e475624c5 100644 --- a/src/view/com/algos/AlgoItem.tsx +++ b/src/view/com/algos/AlgoItem.tsx @@ -11,6 +11,7 @@ import {AlgoItemModel} from 'state/models/feeds/algo/algo-item' const AlgoItem = observer( ({item, style}: {item: AlgoItemModel; style?: StyleProp}) => { const pal = usePalette('default') + return ( @@ -19,7 +20,7 @@ const AlgoItem = observer( - {item.data.displayName ?? 'Feed name'} + {item.data.displayName ? item.data.displayName : 'Feed name'} {item.data.description ?? diff --git a/src/view/screens/CustomAlgorithms.tsx b/src/view/screens/CustomAlgorithms.tsx index 05951f98e..b838660df 100644 --- a/src/view/screens/CustomAlgorithms.tsx +++ b/src/view/screens/CustomAlgorithms.tsx @@ -44,45 +44,46 @@ const CustomAlgorithms = withAuthRequired( ) return ( - + - {!savedFeeds.hasContent || savedFeeds.isEmpty ? ( - - + 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. - - ) : ( - item.data.uri} - refreshControl={ - savedFeeds.refresh()} - tintColor={pal.colors.text} - titleColor={pal.colors.text} - /> - } - onEndReached={() => savedFeeds.loadMore()} - renderItem={({item}) => ( - - )} - initialNumToRender={15} - ListFooterComponent={() => ( - - {savedFeeds.isLoading && } - - )} - extraData={savedFeeds.isLoading} - // @ts-ignore our .web version only -prf - desktopFixedHeight - /> - )} + )} + extraData={savedFeeds.isLoading} + // @ts-ignore our .web version only -prf + desktopFixedHeight + /> ) }), @@ -94,4 +95,11 @@ const styles = StyleSheet.create({ footer: { paddingVertical: 20, }, + empty: { + paddingHorizontal: 20, + paddingVertical: 20, + borderRadius: 16, + marginHorizontal: 24, + marginTop: 10, + }, }) -- cgit 1.4.1