From 990bf306c50e79f69f6a1b53843129d1e05514a5 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Thu, 22 Aug 2024 17:37:15 -0500 Subject: [PATCH] Use RichText for sp description (#4979) * Use RichText for sp description * `isRecord` above --------- Co-authored-by: Hailey --- .../StarterPack/StarterPackLandingScreen.tsx | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/screens/StarterPack/StarterPackLandingScreen.tsx b/src/screens/StarterPack/StarterPackLandingScreen.tsx index 643a7221..7dda45f9 100644 --- a/src/screens/StarterPack/StarterPackLandingScreen.tsx +++ b/src/screens/StarterPack/StarterPackLandingScreen.tsx @@ -31,10 +31,12 @@ import {atoms as a, useTheme} from '#/alf' import {Button, ButtonText} from '#/components/Button' import {useDialogControl} from '#/components/Dialog' import * as FeedCard from '#/components/FeedCard' +import {useRichText} from '#/components/hooks/useRichText' import {LinearGradientBackground} from '#/components/LinearGradientBackground' import {ListMaybePlaceholder} from '#/components/Lists' import {Default as ProfileCard} from '#/components/ProfileCard' import * as Prompt from '#/components/Prompt' +import {RichText} from '#/components/RichText' import {Text} from '#/components/Typography' const AnimatedPressable = Animated.createAnimatedComponent(Pressable) @@ -82,9 +84,15 @@ export function LandingScreen({ return } + // Just for types, this cannot be hit + if (!AppBskyGraphStarterpack.isRecord(starterPack.record)) { + return null + } + return ( @@ -93,22 +101,25 @@ export function LandingScreen({ function LandingScreenLoaded({ starterPack, + starterPackRecord: record, setScreenState, // TODO apply this to profile card moderationOpts, }: { starterPack: AppBskyGraphDefs.StarterPackView + starterPackRecord: AppBskyGraphStarterpack.Record setScreenState: (state: LoggedOutScreenState) => void moderationOpts: ModerationOpts }) { - const {record, creator, listItemsSample, feeds} = starterPack + const {creator, listItemsSample, feeds} = starterPack const {_} = useLingui() const t = useTheme() const activeStarterPack = useActiveStarterPack() const setActiveStarterPack = useSetActiveStarterPack() const {isTabletOrDesktop} = useWebMediaQueries() const androidDialogControl = useDialogControl() + const [descriptionRt] = useRichText(record.description || '') const [appClipOverlayVisible, setAppClipOverlayVisible] = React.useState(false) @@ -147,10 +158,6 @@ function LandingScreenLoaded({ } } - if (!AppBskyGraphStarterpack.isRecord(record)) { - return null - } - return ( {record.description ? ( - - {record.description} - + ) : null}