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/util/UserInfoText.tsx | 68 ++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 39 deletions(-) (limited to 'src/view/com/util/UserInfoText.tsx') diff --git a/src/view/com/util/UserInfoText.tsx b/src/view/com/util/UserInfoText.tsx index 64aa37ff2..028b85d38 100644 --- a/src/view/com/util/UserInfoText.tsx +++ b/src/view/com/util/UserInfoText.tsx @@ -1,27 +1,25 @@ -import {StyleProp, StyleSheet, TextStyle} from 'react-native' -import {AppBskyActorGetProfile as GetProfile} from '@atproto/api' +import {type StyleProp, type TextStyle} from 'react-native' +import {type AppBskyActorGetProfile} from '@atproto/api' import {makeProfileLink} from '#/lib/routes/links' import {sanitizeDisplayName} from '#/lib/strings/display-names' import {sanitizeHandle} from '#/lib/strings/handles' -import {TypographyVariant} from '#/lib/ThemeContext' import {STALE} from '#/state/queries' import {useProfileQuery} from '#/state/queries/profile' -import {TextLinkOnWebOnly} from './Link' +import {atoms as a} from '#/alf' +import {InlineLinkText} from '#/components/Link' +import {Text} from '#/components/Typography' import {LoadingPlaceholder} from './LoadingPlaceholder' -import {Text} from './text/Text' export function UserInfoText({ - type = 'md', did, attr, failed, prefix, style, }: { - type?: TypographyVariant did: string - attr?: keyof GetProfile.OutputSchema + attr?: keyof AppBskyActorGetProfile.OutputSchema loading?: string failed?: string prefix?: string @@ -35,45 +33,37 @@ export function UserInfoText({ staleTime: STALE.INFINITY, }) - let inner if (isError) { - inner = ( - + return ( + {failed} ) } else if (profile) { - inner = ( - - {`${prefix || ''}${sanitizeDisplayName( - typeof profile[attr] === 'string' && profile[attr] - ? (profile[attr] as string) - : sanitizeHandle(profile.handle), - )}`} - - } - /> - ) - } else { - inner = ( - + to={makeProfileLink(profile)}> + + {text} + + ) } - return inner + // eslint-disable-next-line bsky-internal/avoid-unwrapped-text + return ( + + ) } - -const styles = StyleSheet.create({ - loadingPlaceholder: {position: 'relative', top: 1, left: 2}, -}) -- cgit 1.4.1