[🐴] Disable hover card when blocked or blocking (#4041)

zio/stable
Hailey 2024-05-16 08:17:34 -07:00 committed by GitHub
parent 9499d4343d
commit b635d000b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 3 deletions

View File

@ -46,7 +46,11 @@ const floatingMiddlewares = [
const isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0
export function ProfileHoverCard(props: ProfileHoverCardProps) {
return isTouchDevice ? props.children : <ProfileHoverCardInner {...props} />
if (props.disable || isTouchDevice) {
return props.children
} else {
return <ProfileHoverCardInner {...props} />
}
}
type State =

View File

@ -4,4 +4,5 @@ export type ProfileHoverCardProps = {
children: React.ReactElement
did: string
inline?: boolean
disable?: boolean
}

View File

@ -277,6 +277,7 @@ function HeaderReady({
size={32}
profile={profile}
moderation={moderation.ui('avatar')}
disable={moderation.blocked}
/>
<Text
style={[a.text_lg, a.font_bold, a.pt_sm, a.pb_2xs]}

View File

@ -50,8 +50,9 @@ interface EditableUserAvatarProps extends BaseUserAvatarProps {
interface PreviewableUserAvatarProps extends BaseUserAvatarProps {
moderation?: ModerationUI
onBeforePress?: () => void
profile: AppBskyActorDefs.ProfileViewBasic
disable?: boolean
onBeforePress?: () => void
}
const BLUR_AMOUNT = isWeb ? 5 : 100
@ -383,6 +384,7 @@ export {EditableUserAvatar}
let PreviewableUserAvatar = ({
moderation,
profile,
disable,
onBeforePress,
...rest
}: PreviewableUserAvatarProps): React.ReactNode => {
@ -395,7 +397,7 @@ let PreviewableUserAvatar = ({
}, [profile, queryClient, onBeforePress])
return (
<ProfileHoverCard did={profile.did}>
<ProfileHoverCard did={profile.did} disable={disable}>
<Link
label={_(msg`See profile`)}
to={makeProfileLink({