checking list/feed owner on empty state when prompting to add users (#7247)
This commit is contained in:
@@ -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,20 +812,22 @@ 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.`)} />
|
||||||
<NewButton
|
{isOwner && (
|
||||||
label={_(msg`Start adding people`)}
|
<NewButton
|
||||||
onPress={onPressAddUser}
|
label={_(msg`Start adding people`)}
|
||||||
color="primary"
|
onPress={onPressAddUser}
|
||||||
size="small"
|
color="primary"
|
||||||
variant="solid">
|
size="small"
|
||||||
<ButtonIcon icon={PersonPlusIcon} />
|
variant="solid">
|
||||||
<ButtonText>
|
<ButtonIcon icon={PersonPlusIcon} />
|
||||||
<Trans>Start adding people!</Trans>
|
<ButtonText>
|
||||||
</ButtonText>
|
<Trans>Start adding people!</Trans>
|
||||||
</NewButton>
|
</ButtonText>
|
||||||
|
</NewButton>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}, [_, onPressAddUser])
|
}, [_, onPressAddUser, isOwner])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
@@ -928,21 +932,23 @@ const AboutSection = React.forwardRef<SectionRef, AboutSectionProps>(
|
|||||||
icon="users-slash"
|
icon="users-slash"
|
||||||
message={_(msg`This list is empty.`)}
|
message={_(msg`This list is empty.`)}
|
||||||
/>
|
/>
|
||||||
<NewButton
|
{isOwner && (
|
||||||
testID="emptyStateAddUserBtn"
|
<NewButton
|
||||||
label={_(msg`Start adding people`)}
|
testID="emptyStateAddUserBtn"
|
||||||
onPress={onPressAddUser}
|
label={_(msg`Start adding people`)}
|
||||||
color="primary"
|
onPress={onPressAddUser}
|
||||||
size="small"
|
color="primary"
|
||||||
variant="solid">
|
size="small"
|
||||||
<ButtonIcon icon={PersonPlusIcon} />
|
variant="solid">
|
||||||
<ButtonText>
|
<ButtonIcon icon={PersonPlusIcon} />
|
||||||
<Trans>Start adding people!</Trans>
|
<ButtonText>
|
||||||
</ButtonText>
|
<Trans>Start adding people!</Trans>
|
||||||
</NewButton>
|
</ButtonText>
|
||||||
|
</NewButton>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}, [_, onPressAddUser])
|
}, [_, onPressAddUser, isOwner])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
|
|||||||
Reference in New Issue
Block a user