From f84a75669157ed5d2dab2a426d9ff5fefb86a9bb Mon Sep 17 00:00:00 2001 From: Chenyu Huang Date: Thu, 21 Aug 2025 17:52:02 -0700 Subject: optimize for the web --- src/components/dialogs/StarterPackDialog.tsx | 78 ++++++++++++++++------------ src/screens/StarterPack/Wizard/index.tsx | 1 - 2 files changed, 45 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/components/dialogs/StarterPackDialog.tsx b/src/components/dialogs/StarterPackDialog.tsx index 12dfc3d24..ec041d401 100644 --- a/src/components/dialogs/StarterPackDialog.tsx +++ b/src/components/dialogs/StarterPackDialog.tsx @@ -11,6 +11,7 @@ import {useQueryClient} from '@tanstack/react-query' import {useRequireEmailVerification} from '#/lib/hooks/useRequireEmailVerification' import {type NavigationProp} from '#/lib/routes/types' +import {isWeb} from '#/platform/detection' import { invalidateActorStarterPacksWithMembershipQuery, useActorStarterPacksWithMembershipsQuery, @@ -30,7 +31,7 @@ import * as bsky from '#/types/bsky' import {AvatarStack} from '../AvatarStack' import {PlusLarge_Stroke2_Corner0_Rounded} from '../icons/Plus' import {StarterPack} from '../icons/StarterPack' -import {TimesLarge_Stroke2_Corner0_Rounded as XIcon} from '../icons/Times' +import {TimesLarge_Stroke2_Corner0_Rounded} from '../icons/Times' type StarterPackWithMembership = AppBskyGraphGetStarterPacksWithMembership.StarterPackWithMembership @@ -56,9 +57,11 @@ export function StarterPackDialog({ fromDialog: true, targetDid: targetDid, onSuccess: () => { - if (!control.isOpen) { - control.open() - } + setTimeout(() => { + if (!control.isOpen) { + control.open() + } + }, 0) }, }) }, [navigation, control, targetDid]) @@ -88,8 +91,9 @@ function Empty({onStartWizard}: {onStartWizard: () => void}) { const {_} = useLingui() const t = useTheme() + isWeb return ( - + { + return ( + + ) + }, [t]) + const listHeader = ( <> Add to starter packs {membershipItems.length > 0 && ( @@ -213,32 +227,30 @@ function StarterPackList({ ) return ( - <> - ( - - - - ) - : renderItem - } - keyExtractor={ - isLoading - ? () => 'starter_pack_dialog_loader' - : (item: StarterPackWithMembership) => item.starterPack.uri - } - refreshing={false} - onRefresh={_onRefresh} - onEndReached={_onEndReached} - onEndReachedThreshold={0.1} - ListHeaderComponent={listHeader} - ListEmptyComponent={} - contentContainerStyle={[a.px_2xl, a.pt_lg]} - /> - + ( + + + + ) + : renderItem + } + keyExtractor={ + isLoading + ? () => 'starter_pack_dialog_loader' + : (item: StarterPackWithMembership) => item.starterPack.uri + } + refreshing={false} + onRefresh={_onRefresh} + onEndReached={_onEndReached} + onEndReachedThreshold={0.1} + ListHeaderComponent={listHeader} + ListEmptyComponent={} + style={isWeb ? [a.px_md, {minHeight: 500}] : [a.px_2xl, a.pt_lg]} + /> ) } diff --git a/src/screens/StarterPack/Wizard/index.tsx b/src/screens/StarterPack/Wizard/index.tsx index 651f8f77f..839faf9aa 100644 --- a/src/screens/StarterPack/Wizard/index.tsx +++ b/src/screens/StarterPack/Wizard/index.tsx @@ -283,7 +283,6 @@ function WizardInner({ currentListItems: currentListItems, }) } else { - console.log('Creating new starter pack: ', state.profiles) createStarterPack({ name: state.name?.trim() || getDefaultName(), description: state.description?.trim(), -- cgit 1.4.1