From 221623f55aa6c1bbe699c8d409832da110923c76 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Thu, 14 Aug 2025 13:14:18 +0300 Subject: Improve "replied to a post" component (#8602) * unify component * change bottom padding from 2px to 4px --- src/view/com/posts/PostFeedItem.tsx | 84 +++---------------------------------- 1 file changed, 5 insertions(+), 79 deletions(-) (limited to 'src/view/com/posts/PostFeedItem.tsx') diff --git a/src/view/com/posts/PostFeedItem.tsx b/src/view/com/posts/PostFeedItem.tsx index 0593ba931..14bbc4746 100644 --- a/src/view/com/posts/PostFeedItem.tsx +++ b/src/view/com/posts/PostFeedItem.tsx @@ -9,10 +9,6 @@ import { type ModerationDecision, RichText as RichTextAPI, } from '@atproto/api' -import { - FontAwesomeIcon, - type FontAwesomeIconStyle, -} from '@fortawesome/react-native-fontawesome' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {useQueryClient} from '@tanstack/react-query' @@ -26,7 +22,6 @@ import {makeProfileLink} from '#/lib/routes/links' import {sanitizeDisplayName} from '#/lib/strings/display-names' import {sanitizeHandle} from '#/lib/strings/handles' import {countLines} from '#/lib/strings/helpers' -import {s} from '#/lib/styles' import { POST_TOMBSTONE, type Shadow, @@ -54,6 +49,7 @@ import {PostAlerts} from '#/components/moderation/PostAlerts' import {type AppModerationCause} from '#/components/Pills' import {Embed} from '#/components/Post/Embed' import {PostEmbedViewContext} from '#/components/Post/Embed/types' +import {PostRepliedTo} from '#/components/Post/PostRepliedTo' import {ShowMoreTextButton} from '#/components/Post/ShowMoreTextButton' import {PostControls} from '#/components/PostControls' import {DiscoverDebug} from '#/components/PostControls/DiscoverDebug' @@ -448,10 +444,10 @@ let FeedItemInner = ({ /> {showReplyTo && (parentAuthor || isParentBlocked || isParentNotFound) && ( - )} @@ -576,80 +572,10 @@ let PostContent = ({ } PostContent = memo(PostContent) -function ReplyToLabel({ - profile, - blocked, - notFound, -}: { - profile: AppBskyActorDefs.ProfileViewBasic | undefined - blocked?: boolean - notFound?: boolean -}) { - const pal = usePalette('default') - const {currentAccount} = useSession() - - let label - if (blocked) { - label = Reply to a blocked post - } else if (notFound) { - label = Reply to a post - } else if (profile != null) { - const isMe = profile.did === currentAccount?.did - if (isMe) { - label = Reply to you - } else { - label = ( - - Reply to{' '} - - - {profile.displayName - ? sanitizeDisplayName(profile.displayName) - : sanitizeHandle(profile.handle)} - - } - /> - - - ) - } - } - - if (!label) { - // Should not happen. - return null - } - - return ( - - - - {label} - - - ) -} - const styles = StyleSheet.create({ outer: { paddingLeft: 10, paddingRight: 15, - // @ts-ignore web only -prf cursor: 'pointer', }, replyLine: { -- cgit 1.4.1