diff options
author | Ahmed Soliman <ahmed.h.soliman@outlook.com> | 2024-12-23 12:42:10 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-23 17:42:10 +0000 |
commit | 1e4ea1a2717dc88484820cb4f4ad0e21eb79bc5f (patch) | |
tree | a5e7db5b07347c09783a9285d0f3d168704e5b68 /src/view/screens | |
parent | 08a5f7a0bd2934f91b0e7c04df215f9e3ca92f37 (diff) | |
download | voidsky-1e4ea1a2717dc88484820cb4f4ad0e21eb79bc5f.tar.zst |
checking list/feed owner on empty state when prompting to add users (#7247)
Diffstat (limited to 'src/view/screens')
-rw-r--r-- | src/view/screens/ProfileList.tsx | 58 |
1 files changed, 32 insertions, 26 deletions
diff --git a/src/view/screens/ProfileList.tsx b/src/view/screens/ProfileList.tsx index 788f41c55..4558a907b 100644 --- a/src/view/screens/ProfileList.tsx +++ b/src/view/screens/ProfileList.tsx @@ -222,6 +222,7 @@ function ProfileListScreenLoaded({ scrollElRef={scrollElRef as ListRef} headerHeight={headerHeight} isFocused={isScreenFocused && isFocused} + isOwner={isOwner} onPressAddUser={onPressAddUser} /> )} @@ -774,11 +775,12 @@ interface FeedSectionProps { headerHeight: number scrollElRef: ListRef isFocused: boolean + isOwner: boolean onPressAddUser: () => void } const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>( function FeedSectionImpl( - {feed, scrollElRef, headerHeight, isFocused, onPressAddUser}, + {feed, scrollElRef, headerHeight, isFocused, isOwner, onPressAddUser}, ref, ) { const queryClient = useQueryClient() @@ -810,20 +812,22 @@ const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>( return ( <View style={[a.gap_xl, a.align_center]}> <EmptyState icon="hashtag" message={_(msg`This feed is empty.`)} /> - <NewButton - label={_(msg`Start adding people`)} - onPress={onPressAddUser} - color="primary" - size="small" - variant="solid"> - <ButtonIcon icon={PersonPlusIcon} /> - <ButtonText> - <Trans>Start adding people!</Trans> - </ButtonText> - </NewButton> + {isOwner && ( + <NewButton + label={_(msg`Start adding people`)} + onPress={onPressAddUser} + color="primary" + size="small" + variant="solid"> + <ButtonIcon icon={PersonPlusIcon} /> + <ButtonText> + <Trans>Start adding people!</Trans> + </ButtonText> + </NewButton> + )} </View> ) - }, [_, onPressAddUser]) + }, [_, onPressAddUser, isOwner]) return ( <View> @@ -928,21 +932,23 @@ const AboutSection = React.forwardRef<SectionRef, AboutSectionProps>( icon="users-slash" message={_(msg`This list is empty.`)} /> - <NewButton - testID="emptyStateAddUserBtn" - label={_(msg`Start adding people`)} - onPress={onPressAddUser} - color="primary" - size="small" - variant="solid"> - <ButtonIcon icon={PersonPlusIcon} /> - <ButtonText> - <Trans>Start adding people!</Trans> - </ButtonText> - </NewButton> + {isOwner && ( + <NewButton + testID="emptyStateAddUserBtn" + label={_(msg`Start adding people`)} + onPress={onPressAddUser} + color="primary" + size="small" + variant="solid"> + <ButtonIcon icon={PersonPlusIcon} /> + <ButtonText> + <Trans>Start adding people!</Trans> + </ButtonText> + </NewButton> + )} </View> ) - }, [_, onPressAddUser]) + }, [_, onPressAddUser, isOwner]) return ( <View> |