use real info on starter pack card
This commit is contained in:
@@ -1,7 +1,13 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
|
import {AppBskyGraphStarterpack} from '@atproto/api'
|
||||||
import {StarterPackViewBasic} from '@atproto/api/dist/client/types/app/bsky/graph/defs'
|
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 {atoms as a, useTheme} from '#/alf'
|
||||||
import {StarterPackIcon} from '#/components/icons/StarterPackIcon'
|
import {StarterPackIcon} from '#/components/icons/StarterPackIcon'
|
||||||
import {Link} from '#/components/Link'
|
import {Link} from '#/components/Link'
|
||||||
@@ -15,8 +21,16 @@ export function StarterPackCard({
|
|||||||
starterPack: StarterPackViewBasic
|
starterPack: StarterPackViewBasic
|
||||||
hideTopBorder?: boolean
|
hideTopBorder?: boolean
|
||||||
type: 'list' | 'notification'
|
type: 'list' | 'notification'
|
||||||
|
showBy?: boolean
|
||||||
}) {
|
}) {
|
||||||
|
const {_} = useLingui()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
|
const {currentAccount} = useSession()
|
||||||
|
const {record, creator, joinedAllTimeCount} = starterPack
|
||||||
|
|
||||||
|
if (!AppBskyGraphStarterpack.isRecord(record)) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link to={{screen: 'StarterPack', params: {id: starterPack.uri}}}>
|
<Link to={{screen: 'StarterPack', params: {id: starterPack.uri}}}>
|
||||||
@@ -32,16 +46,24 @@ export function StarterPackCard({
|
|||||||
type === 'notification' && [a.mt_sm, a.py_md, a.border, a.rounded_sm],
|
type === 'notification' && [a.mt_sm, a.py_md, a.border, a.rounded_sm],
|
||||||
]}>
|
]}>
|
||||||
{type !== 'notification' && <StarterPackIcon width={36} height={36} />}
|
{type !== 'notification' && <StarterPackIcon width={36} height={36} />}
|
||||||
<View style={a.gap_md}>
|
<View style={a.gap_xs}>
|
||||||
<View>
|
<View style={[isWeb && a.gap_xs]}>
|
||||||
<Text style={[a.font_bold, a.text_md]}>React Native</Text>
|
<Text style={[a.font_bold, a.text_md]}>{record.name}</Text>
|
||||||
<Text style={[t.atoms.text_contrast_medium]}>
|
<Text style={[t.atoms.text_contrast_medium]}>
|
||||||
Starter pack by @haileyok.com
|
<Trans>
|
||||||
|
Starter pack by{' '}
|
||||||
|
{creator?.did === currentAccount?.did
|
||||||
|
? _(msg`you`)
|
||||||
|
: `@${sanitizeHandle(creator.handle)}`}
|
||||||
|
</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
<Text style={[a.font_bold, t.atoms.text_contrast_medium]}>
|
<Text style={[a.font_bold, t.atoms.text_contrast_medium]}>
|
||||||
380 users have joined!
|
{joinedAllTimeCount} users have joined!
|
||||||
</Text>
|
</Text>
|
||||||
|
{record.description && (
|
||||||
|
<Text numberOfLines={3}>{record.description}</Text>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@@ -27,15 +27,12 @@ export function useProfileListsQuery(did: string, opts?: {enabled?: boolean}) {
|
|||||||
cursor: pageParam,
|
cursor: pageParam,
|
||||||
})
|
})
|
||||||
|
|
||||||
return res.data
|
return {
|
||||||
|
...res.data,
|
||||||
// TODO filter out reference lists
|
lists: res.data.lists.filter(
|
||||||
// return {
|
l => l.purpose !== 'app.bsky.graph.defs#referencelist',
|
||||||
// ...res.data,
|
),
|
||||||
// lists: res.data.lists.filter(
|
}
|
||||||
// l => l.purpose !== 'app.bsky.graph.defs#referencelist',
|
|
||||||
// ),
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
initialPageParam: undefined,
|
initialPageParam: undefined,
|
||||||
getNextPageParam: lastPage => lastPage.cursor,
|
getNextPageParam: lastPage => lastPage.cursor,
|
||||||
|
|||||||
Reference in New Issue
Block a user