From 9644e745e5267707f73f4faff5d8551c6448068e Mon Sep 17 00:00:00 2001 From: Hailey Date: Thu, 6 Jun 2024 23:23:52 -0700 Subject: [PATCH] use real info on starter pack card --- .../StarterPack/StarterPackCard.tsx | 32 ++++++++++++++++--- src/state/queries/profile-lists.ts | 15 ++++----- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/components/StarterPack/StarterPackCard.tsx b/src/components/StarterPack/StarterPackCard.tsx index b63d51e2a5..81909d40ef 100644 --- a/src/components/StarterPack/StarterPackCard.tsx +++ b/src/components/StarterPack/StarterPackCard.tsx @@ -1,7 +1,13 @@ import React from 'react' import {View} from 'react-native' +import {AppBskyGraphStarterpack} from '@atproto/api' import {StarterPackViewBasic} from '@atproto/api/dist/client/types/app/bsky/graph/defs' +import {msg, Trans} from '@lingui/macro' +import {useLingui} from '@lingui/react' +import {sanitizeHandle} from 'lib/strings/handles' +import {isWeb} from 'platform/detection' +import {useSession} from 'state/session' import {atoms as a, useTheme} from '#/alf' import {StarterPackIcon} from '#/components/icons/StarterPackIcon' import {Link} from '#/components/Link' @@ -15,8 +21,16 @@ export function StarterPackCard({ starterPack: StarterPackViewBasic hideTopBorder?: boolean type: 'list' | 'notification' + showBy?: boolean }) { + const {_} = useLingui() const t = useTheme() + const {currentAccount} = useSession() + const {record, creator, joinedAllTimeCount} = starterPack + + if (!AppBskyGraphStarterpack.isRecord(record)) { + return null + } return ( @@ -32,16 +46,24 @@ export function StarterPackCard({ type === 'notification' && [a.mt_sm, a.py_md, a.border, a.rounded_sm], ]}> {type !== 'notification' && } - - - React Native + + + {record.name} - Starter pack by @haileyok.com + + Starter pack by{' '} + {creator?.did === currentAccount?.did + ? _(msg`you`) + : `@${sanitizeHandle(creator.handle)}`} + - 380 users have joined! + {joinedAllTimeCount} users have joined! + {record.description && ( + {record.description} + )} diff --git a/src/state/queries/profile-lists.ts b/src/state/queries/profile-lists.ts index a03341db1f..c4990434d4 100644 --- a/src/state/queries/profile-lists.ts +++ b/src/state/queries/profile-lists.ts @@ -27,15 +27,12 @@ export function useProfileListsQuery(did: string, opts?: {enabled?: boolean}) { cursor: pageParam, }) - return res.data - - // TODO filter out reference lists - // return { - // ...res.data, - // lists: res.data.lists.filter( - // l => l.purpose !== 'app.bsky.graph.defs#referencelist', - // ), - // } + return { + ...res.data, + lists: res.data.lists.filter( + l => l.purpose !== 'app.bsky.graph.defs#referencelist', + ), + } }, initialPageParam: undefined, getNextPageParam: lastPage => lastPage.cursor,