Fix profile menu

This commit is contained in:
Eric Bailey
2024-03-14 12:49:46 -05:00
parent 84f4c423fd
commit 2b0db1fa31
2 changed files with 33 additions and 25 deletions
+1 -1
View File
@@ -223,7 +223,7 @@ export function Item({children, label, onPress, ...rest}: ItemProps) {
style={flatten([ style={flatten([
a.flex_row, a.flex_row,
a.align_center, a.align_center,
a.gap_sm, a.gap_lg,
a.py_sm, a.py_sm,
a.rounded_xs, a.rounded_xs,
{minHeight: 32, paddingHorizontal: 10}, {minHeight: 32, paddingHorizontal: 10},
+32 -24
View File
@@ -52,6 +52,10 @@ let ProfileMenu = ({
const reportDialogControl = useReportDialogControl() const reportDialogControl = useReportDialogControl()
const queryClient = useQueryClient() const queryClient = useQueryClient()
const isSelf = currentAccount?.did === profile.did const isSelf = currentAccount?.did === profile.did
const isFollowing = profile.viewer?.following
const isBlocked = profile.viewer?.blocking || profile.viewer?.blockedBy
const isFollowingBlockedAccount = isFollowing && isBlocked
const isLabelerAndNotBlocked = !!profile.associated?.labeler && !isBlocked
const [queueMute, queueUnmute] = useProfileMuteMutationQueue(profile) const [queueMute, queueUnmute] = useProfileMuteMutationQueue(profile)
const [queueBlock, queueUnblock] = useProfileBlockMutationQueue(profile) const [queueBlock, queueUnblock] = useProfileBlockMutationQueue(profile)
@@ -208,22 +212,38 @@ let ProfileMenu = ({
<Menu.ItemIcon icon={Share} /> <Menu.ItemIcon icon={Share} />
</Menu.Item> </Menu.Item>
</Menu.Group> </Menu.Group>
{hasSession && ( {hasSession && (
<> <>
<Menu.Divider /> <Menu.Divider />
<Menu.Group> <Menu.Group>
{!!profile.associated?.labeler && {!isSelf && (
!(profile.viewer?.blocking || profile.viewer?.blockedBy) && ( <>
<Menu.Item {(isLabelerAndNotBlocked || isFollowingBlockedAccount) && (
testID="profileHeaderDropdownFollowBtn" <Menu.Item
label={_(msg`Follow Account`)} testID="profileHeaderDropdownFollowBtn"
onPress={onPressFollowAccount}> label={
<Menu.ItemText> isFollowing
<Trans>Follow Account</Trans> ? _(msg`Unfollow Account`)
</Menu.ItemText> : _(msg`Follow Account`)
<Menu.ItemIcon icon={Plus} /> }
</Menu.Item> onPress={
)} isFollowing
? onPressUnfollowAccount
: onPressFollowAccount
}>
<Menu.ItemText>
{isFollowing ? (
<Trans>Unfollow Account</Trans>
) : (
<Trans>Follow Account</Trans>
)}
</Menu.ItemText>
<Menu.ItemIcon icon={isFollowing ? UserMinus : Plus} />
</Menu.Item>
)}
</>
)}
<Menu.Item <Menu.Item
testID="profileHeaderDropdownListAddRemoveBtn" testID="profileHeaderDropdownListAddRemoveBtn"
label={_(msg`Add to Lists`)} label={_(msg`Add to Lists`)}
@@ -235,18 +255,6 @@ let ProfileMenu = ({
</Menu.Item> </Menu.Item>
{!isSelf && ( {!isSelf && (
<> <>
{profile.viewer?.following &&
(profile.viewer.blocking || profile.viewer.blockedBy) && (
<Menu.Item
testID="profileHeaderDropdownUnfollowBtn"
label={_(msg`Unfollow Account`)}
onPress={onPressUnfollowAccount}>
<Menu.ItemText>
<Trans>Unfollow Account</Trans>
</Menu.ItemText>
<Menu.ItemIcon icon={UserMinus} />
</Menu.Item>
)}
{!profile.viewer?.blocking && {!profile.viewer?.blocking &&
!profile.viewer?.mutedByList && ( !profile.viewer?.mutedByList && (
<Menu.Item <Menu.Item