From ed9691511beb26bdb799bbcb9a973a8b8df3433c Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Sat, 14 Jun 2025 00:41:12 +0300 Subject: Hover card on anchor displayName/handle (#8479) * add hover to anchor display name / handle * use newer link component * Wrap using a single hover element --------- Co-authored-by: Eric Bailey --- src/components/ProfileHoverCard/types.ts | 1 - src/components/RichText.tsx | 10 +-- .../PostThread/components/ThreadItemAnchor.tsx | 85 +++++++++++++--------- src/view/com/post/Post.tsx | 2 +- src/view/com/posts/PostFeedItem.tsx | 4 +- src/view/com/util/PostMeta.tsx | 2 +- 6 files changed, 58 insertions(+), 46 deletions(-) (limited to 'src') diff --git a/src/components/ProfileHoverCard/types.ts b/src/components/ProfileHoverCard/types.ts index 37087dc95..01ef0fce7 100644 --- a/src/components/ProfileHoverCard/types.ts +++ b/src/components/ProfileHoverCard/types.ts @@ -3,6 +3,5 @@ import type React from 'react' export type ProfileHoverCardProps = { children: React.ReactElement did: string - inline?: boolean disable?: boolean } diff --git a/src/components/RichText.tsx b/src/components/RichText.tsx index d501f4287..6493e2342 100644 --- a/src/components/RichText.tsx +++ b/src/components/RichText.tsx @@ -1,14 +1,14 @@ import React from 'react' -import {TextStyle} from 'react-native' +import {type TextStyle} from 'react-native' import {AppBskyRichtextFacet, RichText as RichTextAPI} from '@atproto/api' import {toShortUrl} from '#/lib/strings/url-helpers' -import {atoms as a, flatten, TextStyleProp} from '#/alf' +import {atoms as a, flatten, type TextStyleProp} from '#/alf' import {isOnlyEmoji} from '#/alf/typography' -import {InlineLinkText, LinkProps} from '#/components/Link' +import {InlineLinkText, type LinkProps} from '#/components/Link' import {ProfileHoverCard} from '#/components/ProfileHoverCard' import {RichTextTag} from '#/components/RichTextTag' -import {Text, TextProps} from '#/components/Typography' +import {Text, type TextProps} from '#/components/Typography' const WORD_WRAP = {wordWrap: 1} @@ -105,7 +105,7 @@ export function RichText({ !disableLinks ) { els.push( - + { @@ -321,42 +319,57 @@ const ThreadItemAnchorInner = memo(function ThreadItemAnchorInner({ live={live} onBeforePress={onOpenAuthor} /> - - - - - {sanitizeDisplayName( + + + + - + onPress={onOpenAuthor}> + + {sanitizeDisplayName( + post.author.displayName || + sanitizeHandle(post.author.handle), + moderation.ui('displayName'), + )} + + - - + + + + + + + + {sanitizeHandle(post.author.handle, '@')} + + - - - {sanitizeHandle(post.author.handle, '@')} - - - + {showFollowButton && ( @@ -417,7 +430,7 @@ const ThreadItemAnchorInner = memo(function ThreadItemAnchorInner({ t.atoms.border_contrast_low, ]}> {post.repostCount != null && post.repostCount !== 0 ? ( - + @@ -435,7 +448,7 @@ const ThreadItemAnchorInner = memo(function ThreadItemAnchorInner({ {post.quoteCount != null && post.quoteCount !== 0 && !post.viewer?.embeddingDisabled ? ( - + @@ -451,7 +464,7 @@ const ThreadItemAnchorInner = memo(function ThreadItemAnchorInner({ ) : null} {post.likeCount != null && post.likeCount !== 0 ? ( - + diff --git a/src/view/com/post/Post.tsx b/src/view/com/post/Post.tsx index d92ea6a9d..19017f30f 100644 --- a/src/view/com/post/Post.tsx +++ b/src/view/com/post/Post.tsx @@ -204,7 +204,7 @@ function PostInner({ ) : ( Reply to{' '} - + Reposted by{' '} - + Reply to{' '} - + { )} - +