diff options
author | Seth Wood <sethlwood@me.com> | 2025-02-26 07:33:27 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-26 07:33:27 -0800 |
commit | b924c53b23a86252328cf4304f1d3050f87a2c41 (patch) | |
tree | afed6dc090c6891f0192e883c954f1e20f647df9 /src/view/com/util | |
parent | c5b831d5d87678c65cf212a0d9d9ef5a0792a1a1 (diff) | |
download | voidsky-b924c53b23a86252328cf4304f1d3050f87a2c41.tar.zst |
Fix for avatar preloading (#7816)
* mobile avatar profile preloading fix * updating fix to include moderation * removing comments, adding disableNavigation to PreviewableUserAvatarProps
Diffstat (limited to 'src/view/com/util')
-rw-r--r-- | src/view/com/util/UserAvatar.tsx | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/src/view/com/util/UserAvatar.tsx b/src/view/com/util/UserAvatar.tsx index 5e66a0974..386342103 100644 --- a/src/view/com/util/UserAvatar.tsx +++ b/src/view/com/util/UserAvatar.tsx @@ -66,6 +66,7 @@ interface PreviewableUserAvatarProps extends BaseUserAvatarProps { moderation?: ModerationUI profile: bsky.profile.AnyProfileView disableHoverCard?: boolean + disableNavigation?: boolean onBeforePress?: () => void } @@ -439,6 +440,7 @@ let PreviewableUserAvatar = ({ moderation, profile, disableHoverCard, + disableNavigation, onBeforePress, ...rest }: PreviewableUserAvatarProps): React.ReactNode => { @@ -450,23 +452,31 @@ let PreviewableUserAvatar = ({ precacheProfile(queryClient, profile) }, [profile, queryClient, onBeforePress]) + const avatarEl = ( + <UserAvatar + avatar={profile.avatar} + moderation={moderation} + type={profile.associated?.labeler ? 'labeler' : 'user'} + {...rest} + /> + ) + return ( <ProfileHoverCard did={profile.did} disable={disableHoverCard}> - <Link - label={_(msg`${profile.displayName || profile.handle}'s avatar`)} - accessibilityHint={_(msg`Opens this profile`)} - to={makeProfileLink({ - did: profile.did, - handle: profile.handle, - })} - onPress={onPress}> - <UserAvatar - avatar={profile.avatar} - moderation={moderation} - type={profile.associated?.labeler ? 'labeler' : 'user'} - {...rest} - /> - </Link> + {disableNavigation ? ( + avatarEl + ) : ( + <Link + label={_(msg`${profile.displayName || profile.handle}'s avatar`)} + accessibilityHint={_(msg`Opens this profile`)} + to={makeProfileLink({ + did: profile.did, + handle: profile.handle, + })} + onPress={onPress}> + {avatarEl} + </Link> + )} </ProfileHoverCard> ) } |