diff options
author | Samuel Newman <mozzius@protonmail.com> | 2025-08-14 13:14:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-14 03:14:18 -0700 |
commit | 221623f55aa6c1bbe699c8d409832da110923c76 (patch) | |
tree | 7fca1fc109adf99ad3f92fb2e2b10d964c35a929 /src/view/com/posts | |
parent | f4dca5d230fabf6f1f4f82617964f46e07b8a5be (diff) | |
download | voidsky-221623f55aa6c1bbe699c8d409832da110923c76.tar.zst |
Improve "replied to a post" component (#8602)
* unify component * change bottom padding from 2px to 4px
Diffstat (limited to 'src/view/com/posts')
-rw-r--r-- | src/view/com/posts/PostFeedItem.tsx | 84 |
1 files changed, 5 insertions, 79 deletions
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) && ( - <ReplyToLabel - blocked={isParentBlocked} - notFound={isParentNotFound} - profile={parentAuthor} + <PostRepliedTo + parentAuthor={parentAuthor} + isParentBlocked={isParentBlocked} + isParentNotFound={isParentNotFound} /> )} <LabelsOnMyPost post={post} /> @@ -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 = <Trans context="description">Reply to a blocked post</Trans> - } else if (notFound) { - label = <Trans context="description">Reply to a post</Trans> - } else if (profile != null) { - const isMe = profile.did === currentAccount?.did - if (isMe) { - label = <Trans context="description">Reply to you</Trans> - } else { - label = ( - <Trans context="description"> - Reply to{' '} - <ProfileHoverCard did={profile.did}> - <TextLinkOnWebOnly - type="md" - style={pal.textLight} - lineHeight={1.2} - numberOfLines={1} - href={makeProfileLink(profile)} - text={ - <Text emoji type="md" style={pal.textLight} lineHeight={1.2}> - {profile.displayName - ? sanitizeDisplayName(profile.displayName) - : sanitizeHandle(profile.handle)} - </Text> - } - /> - </ProfileHoverCard> - </Trans> - ) - } - } - - if (!label) { - // Should not happen. - return null - } - - return ( - <View style={[s.flexRow, s.mb2, s.alignCenter]}> - <FontAwesomeIcon - icon="reply" - size={9} - style={[{color: pal.colors.textLight} as FontAwesomeIconStyle, s.mr5]} - /> - <Text - type="md" - style={[pal.textLight, s.mr2]} - lineHeight={1.2} - numberOfLines={1}> - {label} - </Text> - </View> - ) -} - const styles = StyleSheet.create({ outer: { paddingLeft: 10, paddingRight: 15, - // @ts-ignore web only -prf cursor: 'pointer', }, replyLine: { |