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/components/Post/PostRepliedTo.tsx | 63 +++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/components/Post/PostRepliedTo.tsx (limited to 'src/components/Post') diff --git a/src/components/Post/PostRepliedTo.tsx b/src/components/Post/PostRepliedTo.tsx new file mode 100644 index 000000000..3085826c2 --- /dev/null +++ b/src/components/Post/PostRepliedTo.tsx @@ -0,0 +1,63 @@ +import {View} from 'react-native' +import {Trans} from '@lingui/macro' + +import {useSession} from '#/state/session' +import {UserInfoText} from '#/view/com/util/UserInfoText' +import {atoms as a, useTheme} from '#/alf' +import {ArrowCornerDownRight_Stroke2_Corner2_Rounded as ArrowCornerDownRightIcon} from '#/components/icons/ArrowCornerDownRight' +import {ProfileHoverCard} from '#/components/ProfileHoverCard' +import {Text} from '#/components/Typography' +import type * as bsky from '#/types/bsky' + +export function PostRepliedTo({ + parentAuthor, + isParentBlocked, + isParentNotFound, +}: { + parentAuthor: string | bsky.profile.AnyProfileView | undefined + isParentBlocked?: boolean + isParentNotFound?: boolean +}) { + const t = useTheme() + const {currentAccount} = useSession() + + const textStyle = [a.text_sm, t.atoms.text_contrast_medium, a.leading_snug] + + let label + if (isParentBlocked) { + label = Replied to a blocked post + } else if (isParentNotFound) { + label = Replied to a post + } else if (parentAuthor) { + const did = + typeof parentAuthor === 'string' ? parentAuthor : parentAuthor.did + const isMe = currentAccount?.did === did + if (isMe) { + label = Replied to you + } else { + label = ( + + Replied to{' '} + + + + + ) + } + } + + if (!label) { + // Should not happen. + return null + } + + return ( + + + {label} + + ) +} -- cgit 1.4.1