populate the real starter packs

This commit is contained in:
Hailey
2024-06-06 23:04:06 -07:00
parent 964dbf1fa2
commit 146a0641d6
3 changed files with 14 additions and 7 deletions
@@ -80,9 +80,9 @@ export const ProfileStarterPacks = React.forwardRef<
} else if (isEmpty) { } else if (isEmpty) {
items = items.concat([EMPTY]) items = items.concat([EMPTY])
} else if (data?.pages) { } else if (data?.pages) {
for (const page of data?.pages) { console.log('has pages')
items = page.starterPacks console.log(data?.pages)
} items = data?.pages.flatMap(page => page.starterPacks)
} }
if (isError && !isEmpty) { if (isError && !isEmpty) {
items = items.concat([LOAD_MORE_ERROR_ITEM]) items = items.concat([LOAD_MORE_ERROR_ITEM])
@@ -147,7 +147,13 @@ export const ProfileStarterPacks = React.forwardRef<
return <FeedLoadingPlaceholder /> return <FeedLoadingPlaceholder />
} }
if (preferences) { if (preferences) {
return <StarterPackCard type="list" hideTopBorder={index === 0} /> return (
<StarterPackCard
starterPack={item}
type="list"
hideTopBorder={index === 0}
/>
)
} }
return null return null
}, },
@@ -175,7 +181,6 @@ export const ProfileStarterPacks = React.forwardRef<
contentContainerStyle={isNative && {paddingBottom: headerOffset + 100}} contentContainerStyle={isNative && {paddingBottom: headerOffset + 100}}
indicatorStyle={theme.colorScheme === 'dark' ? 'white' : 'black'} indicatorStyle={theme.colorScheme === 'dark' ? 'white' : 'black'}
removeClippedSubviews={true} removeClippedSubviews={true}
// @ts-ignore our .web version only -prf
desktopFixedHeight desktopFixedHeight
onEndReached={onEndReached} onEndReached={onEndReached}
/> />
@@ -1,5 +1,6 @@
import React from 'react' import React from 'react'
import {View} from 'react-native' import {View} from 'react-native'
import {StarterPackViewBasic} from '@atproto/api/dist/client/types/app/bsky/graph/defs'
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'
@@ -7,16 +8,18 @@ import {Link} from '#/components/Link'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
export function StarterPackCard({ export function StarterPackCard({
starterPack,
type, type,
hideTopBorder, hideTopBorder,
}: { }: {
starterPack: StarterPackViewBasic
hideTopBorder?: boolean hideTopBorder?: boolean
type: 'list' | 'notification' type: 'list' | 'notification'
}) { }) {
const t = useTheme() const t = useTheme()
return ( return (
<Link to={{screen: 'StarterPack', params: {id: '123'}}}> <Link to={{screen: 'StarterPack', params: {id: starterPack.uri}}}>
<View <View
style={[ style={[
a.flex_row, a.flex_row,
-1
View File
@@ -15,7 +15,6 @@ export function useStarterPackQuery({id}: {id: string}) {
const res = await agent.app.bsky.graph.getStarterPack({ const res = await agent.app.bsky.graph.getStarterPack({
starterPack: id, starterPack: id,
}) })
return res.data return res.data
}, },
staleTime: STALE.MINUTES.FIVE, staleTime: STALE.MINUTES.FIVE,