From d5f1bf0b4cf20b99a627e97a3370db356374ad68 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Wed, 2 Apr 2025 15:35:19 -0500 Subject: [PATCH] Load state --- src/screens/Search/Explore.tsx | 24 +++++++++- .../Search/components/StarterPackCard.tsx | 48 +++++++++++++++++-- 2 files changed, 67 insertions(+), 5 deletions(-) diff --git a/src/screens/Search/Explore.tsx b/src/screens/Search/Explore.tsx index d0bab40792..ba2376521f 100644 --- a/src/screens/Search/Explore.tsx +++ b/src/screens/Search/Explore.tsx @@ -24,7 +24,10 @@ import { FeedFeedLoadingPlaceholder, ProfileCardFeedLoadingPlaceholder, } from '#/view/com/util/LoadingPlaceholder' -import {StarterPackCard} from '#/screens/Search/components/StarterPackCard' +import { + StarterPackCard, + StarterPackCardSkeleton, +} from '#/screens/Search/components/StarterPackCard' import {ExploreRecommendations} from '#/screens/Search/modules/ExploreRecommendations' import {ExploreTrendingTopics} from '#/screens/Search/modules/ExploreTrendingTopics' import {ExploreTrendingVideos} from '#/screens/Search/modules/ExploreTrendingVideos' @@ -164,6 +167,10 @@ type ExploreScreenItems = key: string view: AppBskyGraphDefs.StarterPackView } + | { + type: 'starterPackSkeleton' + key: string + } export function Explore({ focusSearchInput, @@ -459,6 +466,12 @@ export function Explore({ }) if (isLoadingSuggestedSPs) { + Array.from({length: 3}).forEach((_, index) => + i.push({ + type: 'starterPackSkeleton', + key: `starterPackSkeleton-${index}`, + }), + ) // nothing } else if (suggestedSPsError || !suggestedSPs) { i.pop() @@ -600,11 +613,18 @@ export function Explore({ } case 'starterPack': { return ( - + ) } + case 'starterPackSkeleton': { + return ( + + + + ) + } case 'loadMore': { return ( diff --git a/src/screens/Search/components/StarterPackCard.tsx b/src/screens/Search/components/StarterPackCard.tsx index 0532a7b444..8458d9ca71 100644 --- a/src/screens/Search/components/StarterPackCard.tsx +++ b/src/screens/Search/components/StarterPackCard.tsx @@ -5,16 +5,17 @@ import { AppBskyGraphStarterpack, moderateProfile, } from '@atproto/api' -import {msg,Trans} from '@lingui/macro' +import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {sanitizeHandle} from '#/lib/strings/handles' import {useModerationOpts} from '#/state/preferences/moderation-opts' import {useSession} from '#/state/session' +import {LoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder' import {UserAvatar} from '#/view/com/util/UserAvatar' import {atoms as a, useBreakpoints, useTheme, web} from '#/alf' import {ButtonText} from '#/components/Button' -import {PlusLarge_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus' +import {PlusSmall_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus' import {Link} from '#/components/Link' import {MediaInsetBorder} from '#/components/MediaInsetBorder' import {useStarterPackLink} from '#/components/StarterPack/StarterPackCard' @@ -94,7 +95,7 @@ export function StarterPackCard({ {view.creator?.did === currentAccount?.did ? _(msg`By you`) @@ -251,3 +252,44 @@ export function AvatarStack({ ) } + +export function StarterPackCardSkeleton() { + const t = useTheme() + const {gtPhone} = useBreakpoints() + + const profileCount = gtPhone ? 11 : 8 + + return ( + + + + + + + + + + + + + ) +}