[🐴] Disable hover card when blocked or blocking (#4041)
parent
9499d4343d
commit
b635d000b5
|
@ -46,7 +46,11 @@ const floatingMiddlewares = [
|
||||||
const isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0
|
const isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0
|
||||||
|
|
||||||
export function ProfileHoverCard(props: ProfileHoverCardProps) {
|
export function ProfileHoverCard(props: ProfileHoverCardProps) {
|
||||||
return isTouchDevice ? props.children : <ProfileHoverCardInner {...props} />
|
if (props.disable || isTouchDevice) {
|
||||||
|
return props.children
|
||||||
|
} else {
|
||||||
|
return <ProfileHoverCardInner {...props} />
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type State =
|
type State =
|
||||||
|
|
|
@ -4,4 +4,5 @@ export type ProfileHoverCardProps = {
|
||||||
children: React.ReactElement
|
children: React.ReactElement
|
||||||
did: string
|
did: string
|
||||||
inline?: boolean
|
inline?: boolean
|
||||||
|
disable?: boolean
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,6 +277,7 @@ function HeaderReady({
|
||||||
size={32}
|
size={32}
|
||||||
profile={profile}
|
profile={profile}
|
||||||
moderation={moderation.ui('avatar')}
|
moderation={moderation.ui('avatar')}
|
||||||
|
disable={moderation.blocked}
|
||||||
/>
|
/>
|
||||||
<Text
|
<Text
|
||||||
style={[a.text_lg, a.font_bold, a.pt_sm, a.pb_2xs]}
|
style={[a.text_lg, a.font_bold, a.pt_sm, a.pb_2xs]}
|
||||||
|
|
|
@ -50,8 +50,9 @@ interface EditableUserAvatarProps extends BaseUserAvatarProps {
|
||||||
|
|
||||||
interface PreviewableUserAvatarProps extends BaseUserAvatarProps {
|
interface PreviewableUserAvatarProps extends BaseUserAvatarProps {
|
||||||
moderation?: ModerationUI
|
moderation?: ModerationUI
|
||||||
onBeforePress?: () => void
|
|
||||||
profile: AppBskyActorDefs.ProfileViewBasic
|
profile: AppBskyActorDefs.ProfileViewBasic
|
||||||
|
disable?: boolean
|
||||||
|
onBeforePress?: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const BLUR_AMOUNT = isWeb ? 5 : 100
|
const BLUR_AMOUNT = isWeb ? 5 : 100
|
||||||
|
@ -383,6 +384,7 @@ export {EditableUserAvatar}
|
||||||
let PreviewableUserAvatar = ({
|
let PreviewableUserAvatar = ({
|
||||||
moderation,
|
moderation,
|
||||||
profile,
|
profile,
|
||||||
|
disable,
|
||||||
onBeforePress,
|
onBeforePress,
|
||||||
...rest
|
...rest
|
||||||
}: PreviewableUserAvatarProps): React.ReactNode => {
|
}: PreviewableUserAvatarProps): React.ReactNode => {
|
||||||
|
@ -395,7 +397,7 @@ let PreviewableUserAvatar = ({
|
||||||
}, [profile, queryClient, onBeforePress])
|
}, [profile, queryClient, onBeforePress])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ProfileHoverCard did={profile.did}>
|
<ProfileHoverCard did={profile.did} disable={disable}>
|
||||||
<Link
|
<Link
|
||||||
label={_(msg`See profile`)}
|
label={_(msg`See profile`)}
|
||||||
to={makeProfileLink({
|
to={makeProfileLink({
|
||||||
|
|
Loading…
Reference in New Issue