Disable facets in `FeedCard.Description` component (#4620)
parent
615c0c851e
commit
6cda641250
|
@ -5,6 +5,7 @@ import {
|
||||||
AppBskyFeedDefs,
|
AppBskyFeedDefs,
|
||||||
AppBskyGraphDefs,
|
AppBskyGraphDefs,
|
||||||
AtUri,
|
AtUri,
|
||||||
|
RichText as RichTextApi,
|
||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
import {msg, plural, Trans} from '@lingui/macro'
|
import {msg, plural, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
@ -24,7 +25,6 @@ import * as Toast from 'view/com/util/Toast'
|
||||||
import {useTheme} from '#/alf'
|
import {useTheme} from '#/alf'
|
||||||
import {atoms as a} from '#/alf'
|
import {atoms as a} from '#/alf'
|
||||||
import {Button, ButtonIcon} from '#/components/Button'
|
import {Button, ButtonIcon} from '#/components/Button'
|
||||||
import {useRichText} from '#/components/hooks/useRichText'
|
|
||||||
import {PlusLarge_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus'
|
import {PlusLarge_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus'
|
||||||
import {Trash_Stroke2_Corner0_Rounded as Trash} from '#/components/icons/Trash'
|
import {Trash_Stroke2_Corner0_Rounded as Trash} from '#/components/icons/Trash'
|
||||||
import {Link as InternalLink, LinkProps} from '#/components/Link'
|
import {Link as InternalLink, LinkProps} from '#/components/Link'
|
||||||
|
@ -199,13 +199,14 @@ export function TitleAndBylinePlaceholder({creator}: {creator?: boolean}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Description({description}: {description?: string}) {
|
export function Description({description}: {description?: string}) {
|
||||||
const [rt, isResolving] = useRichText(description || '')
|
const rt = React.useMemo(() => {
|
||||||
if (!description) return null
|
if (!description) return
|
||||||
return isResolving ? (
|
const rt = new RichTextApi({text: description || ''})
|
||||||
<RichText value={description} style={[a.leading_snug]} />
|
rt.detectFacetsWithoutResolution()
|
||||||
) : (
|
return rt
|
||||||
<RichText value={rt} style={[a.leading_snug]} />
|
}, [description])
|
||||||
)
|
if (!rt) return null
|
||||||
|
return <RichText value={rt} style={[a.leading_snug]} disableLinks />
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Likes({count}: {count: number}) {
|
export function Likes({count}: {count: number}) {
|
||||||
|
|
Loading…
Reference in New Issue