diff --git a/src/components/Post/Embed/LazyQuoteEmbed.tsx b/src/components/Post/Embed/LazyQuoteEmbed.tsx index fdc1c6309..7b256fa9d 100644 --- a/src/components/Post/Embed/LazyQuoteEmbed.tsx +++ b/src/components/Post/Embed/LazyQuoteEmbed.tsx @@ -21,6 +21,7 @@ export function LazyQuoteEmbed({uri}: {uri: string}) { type: 'post', view, }} + showPronouns={true} /> ) : ( & { embed: EmbedType<'post'> viewContext?: QuoteEmbedViewContext @@ -398,6 +399,7 @@ export function QuoteEmbed({ author={quote.author} moderation={moderation} showAvatar + showPronouns={showPronouns} postHref={itemHref} timestamp={quote.indexedAt} /> diff --git a/src/components/Post/Embed/types.ts b/src/components/Post/Embed/types.ts index b719d00b4..10b724313 100644 --- a/src/components/Post/Embed/types.ts +++ b/src/components/Post/Embed/types.ts @@ -18,6 +18,7 @@ export type CommonProps = { viewContext?: PostEmbedViewContext isWithinQuote?: boolean allowNestedQuotes?: boolean + showPronouns?: boolean } export type EmbedProps = CommonProps & { diff --git a/src/screens/Profile/Header/Handle.tsx b/src/screens/Profile/Header/Handle.tsx index 3b688ebd9..f4cfbd540 100644 --- a/src/screens/Profile/Header/Handle.tsx +++ b/src/screens/Profile/Header/Handle.tsx @@ -4,6 +4,7 @@ import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' import {isInvalidHandle, sanitizeHandle} from '#/lib/strings/handles' +import {sanitizePronouns} from '#/lib/strings/pronouns' import {type Shadow} from '#/state/cache/types' import {useShowLinkInHandle} from '#/state/preferences/show-link-in-handle.tsx' import {atoms as a, useTheme, web} from '#/alf' diff --git a/src/state/shell/composer/index.tsx b/src/state/shell/composer/index.tsx index 77bd2e46e..52bb34dd8 100644 --- a/src/state/shell/composer/index.tsx +++ b/src/state/shell/composer/index.tsx @@ -22,7 +22,10 @@ export interface ComposerOptsPostRef { cid: string text: string langs?: string[] - author: AppBskyActorDefs.ProfileViewBasic + // remove this after updating atproto api package + author: AppBskyActorDefs.ProfileViewBasic & { + pronouns?: string + } embed?: AppBskyFeedDefs.PostView['embed'] moderation?: ModerationDecision } diff --git a/src/view/com/composer/ComposerReplyTo.tsx b/src/view/com/composer/ComposerReplyTo.tsx index 462779151..a48ffaeba 100644 --- a/src/view/com/composer/ComposerReplyTo.tsx +++ b/src/view/com/composer/ComposerReplyTo.tsx @@ -12,6 +12,7 @@ import {useLingui} from '@lingui/react' import {sanitizeDisplayName} from '#/lib/strings/display-names' import {sanitizeHandle} from '#/lib/strings/handles' +import {sanitizePronouns} from '#/lib/strings/pronouns' import {type ComposerOptsPostRef} from '#/state/shell/composer' import {PreviewableUserAvatar} from '#/view/com/util/UserAvatar' import {atoms as a, useTheme, web} from '#/alf' @@ -100,22 +101,42 @@ export function ComposerReplyTo({replyTo}: {replyTo: ComposerOptsPostRef}) { /> - - {sanitizeDisplayName( - replyTo.author.displayName || - sanitizeHandle(replyTo.author.handle), + + + {sanitizeDisplayName( + replyTo.author.displayName || + sanitizeHandle(replyTo.author.handle), + )} + + {verification.showBadge && ( + + + )} - - {verification.showBadge && ( - - - + + {replyTo.author?.pronouns && ( + + {sanitizePronouns(replyTo.author.pronouns, true)} + )} @@ -132,7 +153,7 @@ export function ComposerReplyTo({replyTo}: {replyTo: ComposerOptsPostRef}) { )} {showFull && parsedQuoteEmbed && parsedQuoteEmbed.type === 'post' && ( - + )} diff --git a/src/view/com/util/PostMeta.tsx b/src/view/com/util/PostMeta.tsx index 6fdda3da8..fc1478036 100644 --- a/src/view/com/util/PostMeta.tsx +++ b/src/view/com/util/PostMeta.tsx @@ -11,6 +11,7 @@ import {forceLTR} from '#/lib/strings/bidi' import {NON_BREAKING_SPACE} from '#/lib/strings/constants' import {sanitizeDisplayName} from '#/lib/strings/display-names' import {sanitizeHandle} from '#/lib/strings/handles' +import {sanitizePronouns} from '#/lib/strings/pronouns' import {niceDate} from '#/lib/strings/time' import {useProfileShadow} from '#/state/cache/profile-shadow' import {precacheProfile} from '#/state/queries/profile' @@ -30,6 +31,7 @@ interface PostMetaOpts { postHref: string timestamp: string showAvatar?: boolean + showPronouns?: boolean avatarSize?: number onOpenAuthor?: () => void style?: StyleProp @@ -42,6 +44,8 @@ let PostMeta = (opts: PostMetaOpts): React.ReactNode => { const author = useProfileShadow(opts.author) const displayName = author.displayName || author.handle const handle = author.handle + // remove dumb typing when you update the atproto api package!! + const pronouns = (author as {pronouns?: string})?.pronouns const profileLink = makeProfileLink(author) const queryClient = useQueryClient() const onOpenAuthor = opts.onOpenAuthor @@ -131,11 +135,29 @@ let PostMeta = (opts: PostMetaOpts): React.ReactNode => { style={[ a.text_md, t.atoms.text_contrast_medium, - {lineHeight:1.17}, + {lineHeight: 1.17}, {flexShrink: 10}, ]}> {NON_BREAKING_SPACE + sanitizeHandle(handle, '@')} + {opts.showPronouns && pronouns && ( + + {NON_BREAKING_SPACE + sanitizePronouns(pronouns)} + + )} @@ -159,18 +181,22 @@ let PostMeta = (opts: PostMetaOpts): React.ReactNode => { whiteSpace: 'nowrap', }), ]}> - {!IS_ANDROID && ( - - ·{' '} - + {!opts.showPronouns && ( + <> + {!IS_ANDROID && ( + + ·{' '} + + )} + {timeElapsed} + )} - {timeElapsed} )}