From 42413e460ec80fba0cd932f30fb265053b175bfc Mon Sep 17 00:00:00 2001 From: Hailey Date: Fri, 14 Jun 2024 15:39:17 -0700 Subject: [PATCH] improve design of starter pack card --- src/components/StarterPack/NewskieDialog.tsx | 19 +++- .../StarterPack/ProfileStarterPacks.tsx | 34 +++--- .../StarterPack/StarterPackCard.tsx | 104 ++++++++---------- src/screens/StarterPack/Wizard/index.tsx | 2 +- 4 files changed, 78 insertions(+), 81 deletions(-) diff --git a/src/components/StarterPack/NewskieDialog.tsx b/src/components/StarterPack/NewskieDialog.tsx index 7466386c2e..aea68bd509 100644 --- a/src/components/StarterPack/NewskieDialog.tsx +++ b/src/components/StarterPack/NewskieDialog.tsx @@ -8,11 +8,11 @@ import {HITSLOP_10} from 'lib/constants' import {ago} from 'lib/strings/time' import {isNative} from 'platform/detection' import {useSession} from 'state/session' -import {atoms as a} from '#/alf' +import {atoms as a, useTheme} from '#/alf' import * as Dialog from '#/components/Dialog' import {useDialogControl} from '#/components/Dialog' import {Newskie} from '#/components/icons/Newskie' -import {StarterPackCard} from '#/components/StarterPack/StarterPackCard' +import {Default as StarterPackCard} from '#/components/StarterPack/StarterPackCard' import {Text} from '#/components/Typography' export function NewskieDialog({ @@ -22,6 +22,7 @@ export function NewskieDialog({ }) { const {_} = useLingui() const {currentAccount} = useSession() + const t = useTheme() const control = useDialogControl() const {joinedViaStarterPack} = profile const profileName = profile.displayName || `@${profile.handle}` @@ -69,10 +70,16 @@ export function NewskieDialog({ )} {joinedViaStarterPack && ( - + + + )} diff --git a/src/components/StarterPack/ProfileStarterPacks.tsx b/src/components/StarterPack/ProfileStarterPacks.tsx index ecc9b20243..af84c5a6e2 100644 --- a/src/components/StarterPack/ProfileStarterPacks.tsx +++ b/src/components/StarterPack/ProfileStarterPacks.tsx @@ -17,9 +17,9 @@ import {useNavigation} from '@react-navigation/native' import {InfiniteData, UseInfiniteQueryResult} from '@tanstack/react-query' import {logger} from '#/logger' -import {isWeb} from '#/platform/detection' import {generateStarterpack} from 'lib/generate-starterpack' import {useBottomBarOffset} from 'lib/hooks/useBottomBarOffset' +import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' import {NavigationProp} from 'lib/routes/types' import {useAgent} from 'state/session' import {List, ListRef} from 'view/com/util/List' @@ -30,7 +30,7 @@ import {useDialogControl} from '#/components/Dialog' import {LinearGradientBackground} from '#/components/LinearGradientBackground' import {Loader} from '#/components/Loader' import * as Prompt from '#/components/Prompt' -import {StarterPackCard} from '#/components/StarterPack/StarterPackCard' +import {Default as StarterPackCard} from '#/components/StarterPack/StarterPackCard' interface SectionRef { scrollToTop: () => void @@ -49,19 +49,6 @@ interface ProfileFeedgensProps { setScrollViewTag: (tag: number | null) => void } -function renderItem({ - item, - index, -}: ListRenderItemInfo) { - return ( - - ) -} - function keyExtractor(item: AppBskyGraphDefs.StarterPackView) { return item.uri } @@ -85,6 +72,7 @@ export const ProfileStarterPacks = React.forwardRef< const bottomBarOffset = useBottomBarOffset(100) const [isPTRing, setIsPTRing] = React.useState(false) const {data, refetch, isFetching, hasNextPage, fetchNextPage} = query + const {isTabletOrDesktop} = useWebMediaQueries() const items = data?.pages.flatMap(page => page.starterPacks) @@ -119,6 +107,22 @@ export const ProfileStarterPacks = React.forwardRef< } }, [enabled, scrollElRef, setScrollViewTag]) + const renderItem = ({ + item, + index, + }: ListRenderItemInfo) => { + return ( + + + + ) + } + return ( + + + + + {record.name} + + + + Starter pack by{' '} + {creator?.did === currentAccount?.did + ? _(msg`you`) + : `@${sanitizeHandle(creator.handle)}`} + + + + + {record.description && ( + {record.description} + )} + {!!joinedAllTimeCount && joinedAllTimeCount >= 50 && ( + + {joinedAllTimeCount} users have joined! + + )} + + ) +} + +function Wrapper({ + creator, + children, + rkey, +}: { + creator: AppBskyActorDefs.ProfileViewBasic + rkey: string + children: React.ReactNode +}) { return ( - - {type !== 'notification' && } - - - {record.name} - {!hideBy && ( - - - Starter pack by{' '} - {creator?.did === currentAccount?.did - ? _(msg`you`) - : `@${sanitizeHandle(creator.handle)}`} - - - )} - - {!!joinedAllTimeCount && joinedAllTimeCount >= 50 && ( - - {joinedAllTimeCount} users have joined! - - )} - {record.description && ( - {record.description} - )} - - + {children} ) } diff --git a/src/screens/StarterPack/Wizard/index.tsx b/src/screens/StarterPack/Wizard/index.tsx index c445c3a0cb..a456867752 100644 --- a/src/screens/StarterPack/Wizard/index.tsx +++ b/src/screens/StarterPack/Wizard/index.tsx @@ -559,7 +559,7 @@ function Footer({ t.atoms.bg, t.atoms.border_contrast_medium, { - height: isNative ? 224 : 200, + height: 190 + bottomInset, paddingBottom: 20 + bottomInset, }, isNative && [