checking list/feed owner on empty state when prompting to add users (#7247)

This commit is contained in:
Ahmed Soliman
2024-12-23 12:42:10 -05:00
committed by GitHub
parent 08a5f7a0bd
commit 1e4ea1a271
+9 -3
View File
@@ -222,6 +222,7 @@ function ProfileListScreenLoaded({
scrollElRef={scrollElRef as ListRef} scrollElRef={scrollElRef as ListRef}
headerHeight={headerHeight} headerHeight={headerHeight}
isFocused={isScreenFocused && isFocused} isFocused={isScreenFocused && isFocused}
isOwner={isOwner}
onPressAddUser={onPressAddUser} onPressAddUser={onPressAddUser}
/> />
)} )}
@@ -774,11 +775,12 @@ interface FeedSectionProps {
headerHeight: number headerHeight: number
scrollElRef: ListRef scrollElRef: ListRef
isFocused: boolean isFocused: boolean
isOwner: boolean
onPressAddUser: () => void onPressAddUser: () => void
} }
const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>( const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>(
function FeedSectionImpl( function FeedSectionImpl(
{feed, scrollElRef, headerHeight, isFocused, onPressAddUser}, {feed, scrollElRef, headerHeight, isFocused, isOwner, onPressAddUser},
ref, ref,
) { ) {
const queryClient = useQueryClient() const queryClient = useQueryClient()
@@ -810,6 +812,7 @@ const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>(
return ( return (
<View style={[a.gap_xl, a.align_center]}> <View style={[a.gap_xl, a.align_center]}>
<EmptyState icon="hashtag" message={_(msg`This feed is empty.`)} /> <EmptyState icon="hashtag" message={_(msg`This feed is empty.`)} />
{isOwner && (
<NewButton <NewButton
label={_(msg`Start adding people`)} label={_(msg`Start adding people`)}
onPress={onPressAddUser} onPress={onPressAddUser}
@@ -821,9 +824,10 @@ const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>(
<Trans>Start adding people!</Trans> <Trans>Start adding people!</Trans>
</ButtonText> </ButtonText>
</NewButton> </NewButton>
)}
</View> </View>
) )
}, [_, onPressAddUser]) }, [_, onPressAddUser, isOwner])
return ( return (
<View> <View>
@@ -928,6 +932,7 @@ const AboutSection = React.forwardRef<SectionRef, AboutSectionProps>(
icon="users-slash" icon="users-slash"
message={_(msg`This list is empty.`)} message={_(msg`This list is empty.`)}
/> />
{isOwner && (
<NewButton <NewButton
testID="emptyStateAddUserBtn" testID="emptyStateAddUserBtn"
label={_(msg`Start adding people`)} label={_(msg`Start adding people`)}
@@ -940,9 +945,10 @@ const AboutSection = React.forwardRef<SectionRef, AboutSectionProps>(
<Trans>Start adding people!</Trans> <Trans>Start adding people!</Trans>
</ButtonText> </ButtonText>
</NewButton> </NewButton>
)}
</View> </View>
) )
}, [_, onPressAddUser]) }, [_, onPressAddUser, isOwner])
return ( return (
<View> <View>