diff --git a/src/components/Post/Embed/index.tsx b/src/components/Post/Embed/index.tsx index f999df2e7b..609d4c7f6f 100644 --- a/src/components/Post/Embed/index.tsx +++ b/src/components/Post/Embed/index.tsx @@ -285,15 +285,14 @@ export function QuoteEmbed({ const contents = ( <> - - - + {moderation ? ( ) : null} diff --git a/src/view/com/util/PostMeta.tsx b/src/view/com/util/PostMeta.tsx index 1a37e55cbd..470d28e179 100644 --- a/src/view/com/util/PostMeta.tsx +++ b/src/view/com/util/PostMeta.tsx @@ -12,7 +12,7 @@ import {sanitizeDisplayName} from '#/lib/strings/display-names' import {sanitizeHandle} from '#/lib/strings/handles' import {niceDate} from '#/lib/strings/time' import {useProfileShadow} from '#/state/cache/profile-shadow' -import {precacheProfile} from '#/state/queries/profile' +import {unstableCacheProfileView} from '#/state/queries/profile' import {atoms as a, platform, useTheme, web} from '#/alf' import {WebOnlyInlineLinkText} from '#/components/Link' import {ProfileHoverCard} from '#/components/ProfileHoverCard' @@ -29,6 +29,7 @@ interface PostMetaOpts { moderation: ModerationDecision | undefined postHref: string timestamp: string + linkDisabled?: boolean showAvatar?: boolean avatarSize?: number onOpenAuthor?: () => void @@ -46,17 +47,19 @@ let PostMeta = (opts: PostMetaOpts): React.ReactNode => { const queryClient = useQueryClient() const onOpenAuthor = opts.onOpenAuthor const onBeforePressAuthor = useCallback(() => { - precacheProfile(queryClient, author) + unstableCacheProfileView(queryClient, author) onOpenAuthor?.() }, [queryClient, author, onOpenAuthor]) const onBeforePressPost = useCallback(() => { - precacheProfile(queryClient, author) + unstableCacheProfileView(queryClient, author) }, [queryClient, author]) const timestampLabel = niceDate(i18n, opts.timestamp) const verification = useSimpleVerificationState({profile: author}) const {isActive: live} = useActorStatus(author) + const MaybeLinkText = opts.linkDisabled ? Text : WebOnlyInlineLinkText + return ( { type={author.associated?.labeler ? 'labeler' : 'user'} live={live} hideLiveBadge + disableNavigation={opts.linkDisabled} /> )} - { opts.moderation?.ui('displayName'), ), )} - + {verification.showBadge && ( { /> )} - { {flexShrink: 10}, ]}> {NON_BREAKING_SPACE + sanitizeHandle(handle, '@')} - + {({timeElapsed}) => ( - { )} {timeElapsed} - + )} diff --git a/src/view/com/util/TimeElapsed.tsx b/src/view/com/util/TimeElapsed.tsx index 146b0d523a..c28e9cd90f 100644 --- a/src/view/com/util/TimeElapsed.tsx +++ b/src/view/com/util/TimeElapsed.tsx @@ -1,4 +1,4 @@ -import React, {type JSX} from 'react' +import {useState} from 'react' import {type I18n} from '@lingui/core' import {useLingui} from '@lingui/react' @@ -11,17 +11,17 @@ export function TimeElapsed({ timeToString, }: { timestamp: string - children: ({timeElapsed}: {timeElapsed: string}) => JSX.Element + children: ({timeElapsed}: {timeElapsed: string}) => React.ReactElement timeToString?: (i18n: I18n, timeElapsed: string) => string }) { const {i18n} = useLingui() const ago = useGetTimeAgo() const tick = useTickEveryMinute() - const [timeElapsed, setTimeAgo] = React.useState(() => + const [timeElapsed, setTimeAgo] = useState(() => timeToString ? timeToString(i18n, timestamp) : ago(timestamp, tick), ) - const [prevTick, setPrevTick] = React.useState(tick) + const [prevTick, setPrevTick] = useState(tick) if (prevTick !== tick) { setPrevTick(tick) setTimeAgo(