add profile hover card to notif items (#8666)

This commit is contained in:
Samuel Newman
2025-08-07 19:15:49 +03:00
committed by GitHub
parent cb54082eda
commit 0a2b1fcfb8
5 changed files with 41 additions and 30 deletions
+6
View File
@@ -979,6 +979,12 @@ export const atoms = {
hidden: { hidden: {
display: 'none', display: 'none',
}, },
inline: web({
display: 'inline',
}),
block: web({
display: 'block',
}),
/* /*
* Transition * Transition
+1 -1
View File
@@ -1,4 +1,4 @@
import {ProfileHoverCardProps} from './types' import {type ProfileHoverCardProps} from './types'
export function ProfileHoverCard({children}: ProfileHoverCardProps) { export function ProfileHoverCard({children}: ProfileHoverCardProps) {
return children return children
@@ -74,7 +74,9 @@ export function ProfileHoverCard(props: ProfileHoverCardProps) {
return props.children return props.children
} else { } else {
return ( return (
<View onPointerMove={onPointerMove} style={[a.flex_shrink, props.style]}> <View
onPointerMove={onPointerMove}
style={[a.flex_shrink, props.inline && a.inline, props.style]}>
<ProfileHoverCardInner {...props} /> <ProfileHoverCardInner {...props} />
</View> </View>
) )
@@ -326,7 +328,7 @@ export function ProfileHoverCardInner(props: ProfileHoverCardProps) {
onPointerLeave={onPointerLeaveTarget} onPointerLeave={onPointerLeaveTarget}
// @ts-ignore web only prop // @ts-ignore web only prop
onMouseUp={onPress} onMouseUp={onPress}
style={{flexShrink: 1}}> style={[a.flex_shrink, props.inline && a.inline]}>
{props.children} {props.children}
{isVisible && ( {isVisible && (
<Portal> <Portal>
+1
View File
@@ -6,4 +6,5 @@ export type ProfileHoverCardProps = ViewStyleProp & {
children: React.ReactNode children: React.ReactNode
did: string did: string
disable?: boolean disable?: boolean
inline?: boolean
} }
@@ -209,33 +209,35 @@ let NotificationFeedItem = ({
} }
const firstAuthorLink = ( const firstAuthorLink = (
<InlineLinkText <ProfileHoverCard did={firstAuthor.profile.did} inline>
key={firstAuthor.href} <InlineLinkText
style={[t.atoms.text, a.font_bold, a.text_md, a.leading_tight]} key={firstAuthor.href}
to={firstAuthor.href} style={[t.atoms.text, a.font_bold, a.text_md, a.leading_tight]}
disableMismatchWarning to={firstAuthor.href}
emoji disableMismatchWarning
label={_(msg`Go to ${firstAuthorName}'s profile`)}> emoji
{forceLTR(firstAuthorName)} label={_(msg`Go to ${firstAuthorName}'s profile`)}>
{firstAuthorVerification.showBadge && ( {forceLTR(firstAuthorName)}
<View {firstAuthorVerification.showBadge && (
style={[ <View
a.relative, style={[
{ a.relative,
paddingTop: platform({android: 2}), {
marginBottom: platform({ios: -7}), paddingTop: platform({android: 2}),
top: platform({web: 1}), marginBottom: platform({ios: -7}),
paddingLeft: 3, top: platform({web: 1}),
paddingRight: 2, paddingLeft: 3,
}, paddingRight: 2,
]}> },
<VerificationCheck ]}>
width={14} <VerificationCheck
verifier={firstAuthorVerification.role === 'verifier'} width={14}
/> verifier={firstAuthorVerification.role === 'verifier'}
</View> />
)} </View>
</InlineLinkText> )}
</InlineLinkText>
</ProfileHoverCard>
) )
const additionalAuthorsCount = authors.length - 1 const additionalAuthorsCount = authors.length - 1
const hasMultipleAuthors = additionalAuthorsCount > 0 const hasMultipleAuthors = additionalAuthorsCount > 0