diff options
author | Samuel Newman <mozzius@protonmail.com> | 2025-08-07 19:15:49 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-07 09:15:49 -0700 |
commit | 0a2b1fcfb808c9ddd503fac5247d1acf256cfb45 (patch) | |
tree | 0f56e7c9d332aa6599778f67777e3d1f3b0519d5 | |
parent | cb54082edab73fd8e7f736e5b883b87e052604a8 (diff) | |
download | voidsky-0a2b1fcfb808c9ddd503fac5247d1acf256cfb45.tar.zst |
add profile hover card to notif items (#8666)
-rw-r--r-- | src/alf/atoms.ts | 6 | ||||
-rw-r--r-- | src/components/ProfileHoverCard/index.tsx | 2 | ||||
-rw-r--r-- | src/components/ProfileHoverCard/index.web.tsx | 6 | ||||
-rw-r--r-- | src/components/ProfileHoverCard/types.ts | 1 | ||||
-rw-r--r-- | src/view/com/notifications/NotificationFeedItem.tsx | 56 |
5 files changed, 41 insertions, 30 deletions
diff --git a/src/alf/atoms.ts b/src/alf/atoms.ts index 572560217..fe449c6ee 100644 --- a/src/alf/atoms.ts +++ b/src/alf/atoms.ts @@ -979,6 +979,12 @@ export const atoms = { hidden: { display: 'none', }, + inline: web({ + display: 'inline', + }), + block: web({ + display: 'block', + }), /* * Transition diff --git a/src/components/ProfileHoverCard/index.tsx b/src/components/ProfileHoverCard/index.tsx index 980336ee4..b33fdec2d 100644 --- a/src/components/ProfileHoverCard/index.tsx +++ b/src/components/ProfileHoverCard/index.tsx @@ -1,4 +1,4 @@ -import {ProfileHoverCardProps} from './types' +import {type ProfileHoverCardProps} from './types' export function ProfileHoverCard({children}: ProfileHoverCardProps) { return children diff --git a/src/components/ProfileHoverCard/index.web.tsx b/src/components/ProfileHoverCard/index.web.tsx index eb6efa4c9..5aa57cde1 100644 --- a/src/components/ProfileHoverCard/index.web.tsx +++ b/src/components/ProfileHoverCard/index.web.tsx @@ -74,7 +74,9 @@ export function ProfileHoverCard(props: ProfileHoverCardProps) { return props.children } else { 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} /> </View> ) @@ -326,7 +328,7 @@ export function ProfileHoverCardInner(props: ProfileHoverCardProps) { onPointerLeave={onPointerLeaveTarget} // @ts-ignore web only prop onMouseUp={onPress} - style={{flexShrink: 1}}> + style={[a.flex_shrink, props.inline && a.inline]}> {props.children} {isVisible && ( <Portal> diff --git a/src/components/ProfileHoverCard/types.ts b/src/components/ProfileHoverCard/types.ts index 7d9e19ac5..f99254e40 100644 --- a/src/components/ProfileHoverCard/types.ts +++ b/src/components/ProfileHoverCard/types.ts @@ -6,4 +6,5 @@ export type ProfileHoverCardProps = ViewStyleProp & { children: React.ReactNode did: string disable?: boolean + inline?: boolean } diff --git a/src/view/com/notifications/NotificationFeedItem.tsx b/src/view/com/notifications/NotificationFeedItem.tsx index 4de21e598..d5aba86f7 100644 --- a/src/view/com/notifications/NotificationFeedItem.tsx +++ b/src/view/com/notifications/NotificationFeedItem.tsx @@ -209,33 +209,35 @@ let NotificationFeedItem = ({ } const firstAuthorLink = ( - <InlineLinkText - key={firstAuthor.href} - style={[t.atoms.text, a.font_bold, a.text_md, a.leading_tight]} - to={firstAuthor.href} - disableMismatchWarning - emoji - label={_(msg`Go to ${firstAuthorName}'s profile`)}> - {forceLTR(firstAuthorName)} - {firstAuthorVerification.showBadge && ( - <View - style={[ - a.relative, - { - paddingTop: platform({android: 2}), - marginBottom: platform({ios: -7}), - top: platform({web: 1}), - paddingLeft: 3, - paddingRight: 2, - }, - ]}> - <VerificationCheck - width={14} - verifier={firstAuthorVerification.role === 'verifier'} - /> - </View> - )} - </InlineLinkText> + <ProfileHoverCard did={firstAuthor.profile.did} inline> + <InlineLinkText + key={firstAuthor.href} + style={[t.atoms.text, a.font_bold, a.text_md, a.leading_tight]} + to={firstAuthor.href} + disableMismatchWarning + emoji + label={_(msg`Go to ${firstAuthorName}'s profile`)}> + {forceLTR(firstAuthorName)} + {firstAuthorVerification.showBadge && ( + <View + style={[ + a.relative, + { + paddingTop: platform({android: 2}), + marginBottom: platform({ios: -7}), + top: platform({web: 1}), + paddingLeft: 3, + paddingRight: 2, + }, + ]}> + <VerificationCheck + width={14} + verifier={firstAuthorVerification.role === 'verifier'} + /> + </View> + )} + </InlineLinkText> + </ProfileHoverCard> ) const additionalAuthorsCount = authors.length - 1 const hasMultipleAuthors = additionalAuthorsCount > 0 |