diff options
author | Ansh Nanda <anshnanda10@gmail.com> | 2023-05-18 10:34:34 -0700 |
---|---|---|
committer | Ansh Nanda <anshnanda10@gmail.com> | 2023-05-18 10:34:34 -0700 |
commit | 571fc37a9920d3b7b13a9eed2c46513036f3a4f4 (patch) | |
tree | 68c6076326b93e64e0b4a95fe1e0132d22d64ae3 | |
parent | acea0e074d75ac549abb01dc4ac16573a43ad7fa (diff) | |
download | voidsky-571fc37a9920d3b7b13a9eed2c46513036f3a4f4.tar.zst |
fix error & empty state when rendering custom feeds on profile
-rw-r--r-- | src/view/screens/Profile.tsx | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/view/screens/Profile.tsx b/src/view/screens/Profile.tsx index bf312cd06..5f31c89c9 100644 --- a/src/view/screens/Profile.tsx +++ b/src/view/screens/Profile.tsx @@ -120,6 +120,7 @@ export const ProfileScreen = withAuthRequired( }, [uiState.showLoadingMoreFooter]) const renderItem = React.useCallback( (item: any) => { + // if section is lists if (uiState.selectedView === Sections.Lists) { if (item === ProfileUiModel.LOADING_ITEM) { return <ProfileCardFeedLoadingPlaceholder /> @@ -144,6 +145,32 @@ export const ProfileScreen = withAuthRequired( } else { return <ListCard testID={`list-${item.name}`} list={item} /> } + // if section is custom algorithms + } else if (uiState.selectedView === Sections.CustomAlgorithms) { + if (item === ProfileUiModel.LOADING_ITEM) { + return <ProfileCardFeedLoadingPlaceholder /> + } else if (item._reactKey === '__error__') { + return ( + <View style={s.p5}> + <ErrorMessage + message={item.error} + onPressTryAgain={onPressTryAgain} + /> + </View> + ) + } else if (item === ProfileUiModel.EMPTY_ITEM) { + return ( + <EmptyState + testID="customAlgorithmsEmpty" + icon="list-ul" + message="No custom algorithms yet!" + style={styles.emptyState} + /> + ) + } else if (item instanceof CustomFeedModel) { + return <CustomFeed item={item} showSaveBtn showLikes /> + } + // if section is posts or posts & replies } else { if (item === ProfileUiModel.END_ITEM) { return <Text style={styles.endItem}>- end of feed -</Text> @@ -188,8 +215,6 @@ export const ProfileScreen = withAuthRequired( return ( <FeedSlice slice={item} ignoreMuteFor={uiState.profile.did} /> ) - } else if (item instanceof CustomFeedModel) { - return <CustomFeed item={item} showSaveBtn showLikes /> } } return <View /> |