From c959dc351fe174cc96d84d971f5d2072e9fbc7e7 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Sat, 14 Dec 2024 15:30:01 -0600 Subject: `ProfileFeed` cleanups (#7115) * Clean up feed load state * Fix feed info dialog load state --- src/screens/Profile/ProfileFeed/index.tsx | 21 +++++++-- .../Profile/components/ProfileFeedHeader.tsx | 53 ++++++++++++++++------ 2 files changed, 56 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/screens/Profile/ProfileFeed/index.tsx b/src/screens/Profile/ProfileFeed/index.tsx index 7d48b5ac1..3a8686a7d 100644 --- a/src/screens/Profile/ProfileFeed/index.tsx +++ b/src/screens/Profile/ProfileFeed/index.tsx @@ -34,9 +34,12 @@ import {FAB} from '#/view/com/util/fab/FAB' import {Button} from '#/view/com/util/forms/Button' import {ListRef} from '#/view/com/util/List' import {LoadLatestBtn} from '#/view/com/util/load-latest/LoadLatestBtn' -import {LoadingScreen} from '#/view/com/util/LoadingScreen' +import {PostFeedLoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder' import {Text} from '#/view/com/util/text/Text' -import {ProfileFeedHeader} from '#/screens/Profile/components/ProfileFeedHeader' +import { + ProfileFeedHeader, + ProfileFeedHeaderSkeleton, +} from '#/screens/Profile/components/ProfileFeedHeader' import * as Layout from '#/components/Layout' type Props = NativeStackScreenProps @@ -92,12 +95,15 @@ export function ProfileFeedScreen(props: Props) { } return resolvedUri ? ( - + ) : ( - + + + + ) } @@ -107,7 +113,12 @@ function ProfileFeedScreenIntermediate({feedUri}: {feedUri: string}) { const {data: info} = useFeedSourceInfoQuery({uri: feedUri}) if (!preferences || !info) { - return + return ( + + + + + ) } return ( diff --git a/src/screens/Profile/components/ProfileFeedHeader.tsx b/src/screens/Profile/components/ProfileFeedHeader.tsx index 87b242a55..6bfbff3a0 100644 --- a/src/screens/Profile/components/ProfileFeedHeader.tsx +++ b/src/screens/Profile/components/ProfileFeedHeader.tsx @@ -1,6 +1,5 @@ import React from 'react' import {View} from 'react-native' -import {useSafeAreaInsets} from 'react-native-safe-area-context' import {AtUri} from '@atproto/api' import {msg, Plural, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' @@ -46,18 +45,53 @@ import {TimesLarge_Stroke2_Corner0_Rounded as X} from '#/components/icons/Times' import {Trash_Stroke2_Corner0_Rounded as Trash} from '#/components/icons/Trash' import * as Layout from '#/components/Layout' import {InlineLinkText} from '#/components/Link' -import {Loader} from '#/components/Loader' import * as Menu from '#/components/Menu' import {ReportDialog, useReportDialogControl} from '#/components/ReportDialog' import {RichText} from '#/components/RichText' import {Text} from '#/components/Typography' +export function ProfileFeedHeaderSkeleton() { + const t = useTheme() + + return ( + + + + + + + + + + + + ) +} + export function ProfileFeedHeader({info}: {info: FeedSourceFeedInfo}) { const t = useTheme() const {_, i18n} = useLingui() const {hasSession} = useSession() const {gtPhone, gtMobile} = useBreakpoints() - const {top} = useSafeAreaInsets() const infoControl = Dialog.useDialogControl() const playHaptic = useHaptics() @@ -148,12 +182,7 @@ export function ProfileFeedHeader({info}: {info: FeedSourceFeedInfo}) { return ( <> + style={[t.atoms.bg, a.z_10, web([a.sticky, a.z_10, {top: 0}])]}> @@ -356,7 +385,7 @@ function DialogInner({ const playHaptic = useHaptics() const control = Dialog.useDialogContext() const reportDialogControl = useReportDialogControl() - const [rt, loading] = useRichText(info.description.text) + const [rt] = useRichText(info.description.text) const {mutateAsync: likeFeed, isPending: isLikePending} = useLikeMutation() const {mutateAsync: unlikeFeed, isPending: isUnlikePending} = useUnlikeMutation() @@ -396,9 +425,7 @@ function DialogInner({ reportDialogControl.open() }, [reportDialogControl]) - return loading ? ( - - ) : ( + return ( -- cgit 1.4.1