implement new feed card fully
This commit is contained in:
@@ -4,15 +4,13 @@ import {AppBskyFeedDefs} from '@atproto/api'
|
|||||||
import {GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs'
|
import {GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs'
|
||||||
|
|
||||||
import {useBottomBarOffset} from 'lib/hooks/useBottomBarOffset'
|
import {useBottomBarOffset} from 'lib/hooks/useBottomBarOffset'
|
||||||
|
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
|
||||||
import {isNative} from 'platform/detection'
|
import {isNative} from 'platform/detection'
|
||||||
import {List, ListRef} from 'view/com/util/List'
|
import {List, ListRef} from 'view/com/util/List'
|
||||||
import {SectionRef} from '#/screens/Profile/Sections/types'
|
import {SectionRef} from '#/screens/Profile/Sections/types'
|
||||||
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import * as FeedCard from '#/components/FeedCard'
|
import * as FeedCard from '#/components/FeedCard'
|
||||||
|
|
||||||
function renderItem({item}: ListRenderItemInfo<GeneratorView>) {
|
|
||||||
return <FeedCard.Default feed={item} />
|
|
||||||
}
|
|
||||||
|
|
||||||
function keyExtractor(item: AppBskyFeedDefs.GeneratorView) {
|
function keyExtractor(item: AppBskyFeedDefs.GeneratorView) {
|
||||||
return item.uri
|
return item.uri
|
||||||
}
|
}
|
||||||
@@ -27,6 +25,8 @@ export const FeedsList = React.forwardRef<SectionRef, ProfilesListProps>(
|
|||||||
function FeedsListImpl({feeds, headerHeight, scrollElRef}, ref) {
|
function FeedsListImpl({feeds, headerHeight, scrollElRef}, ref) {
|
||||||
const [initialHeaderHeight] = React.useState(headerHeight)
|
const [initialHeaderHeight] = React.useState(headerHeight)
|
||||||
const bottomBarOffset = useBottomBarOffset(20)
|
const bottomBarOffset = useBottomBarOffset(20)
|
||||||
|
const {isTabletOrDesktop} = useWebMediaQueries()
|
||||||
|
const t = useTheme()
|
||||||
|
|
||||||
const onScrollToTop = useCallback(() => {
|
const onScrollToTop = useCallback(() => {
|
||||||
scrollElRef.current?.scrollToOffset({
|
scrollElRef.current?.scrollToOffset({
|
||||||
@@ -39,6 +39,19 @@ export const FeedsList = React.forwardRef<SectionRef, ProfilesListProps>(
|
|||||||
scrollToTop: onScrollToTop,
|
scrollToTop: onScrollToTop,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
const renderItem = ({item, index}: ListRenderItemInfo<GeneratorView>) => {
|
||||||
|
return (
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
a.p_lg,
|
||||||
|
(isTabletOrDesktop || index !== 0) && a.border_t,
|
||||||
|
t.atoms.border_contrast_low,
|
||||||
|
]}>
|
||||||
|
<FeedCard.Default feed={item} />
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<List
|
<List
|
||||||
data={feeds}
|
data={feeds}
|
||||||
|
|||||||
+2
-1
@@ -5,7 +5,7 @@ import {AppBskyGraphDefs} from '@atproto/api'
|
|||||||
import {UserAvatar} from 'view/com/util/UserAvatar'
|
import {UserAvatar} from 'view/com/util/UserAvatar'
|
||||||
import {atoms as a} from '#/alf'
|
import {atoms as a} from '#/alf'
|
||||||
|
|
||||||
export function StarterPackAvatarsIcon({
|
export function StarterPackAvatar({
|
||||||
starterPack,
|
starterPack,
|
||||||
size = 60,
|
size = 60,
|
||||||
}: {
|
}: {
|
||||||
@@ -21,6 +21,7 @@ export function StarterPackAvatarsIcon({
|
|||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
a.rounded_sm,
|
a.rounded_sm,
|
||||||
|
a.overflow_hidden,
|
||||||
{height: size, width: size, backgroundColor: '#0070FF'},
|
{height: size, width: size, backgroundColor: '#0070FF'},
|
||||||
]}>
|
]}>
|
||||||
<View style={[a.flex_1, a.flex_row]}>
|
<View style={[a.flex_1, a.flex_row]}>
|
||||||
@@ -300,6 +300,7 @@ function WizardInner({
|
|||||||
createdAt: initialCreatedAt,
|
createdAt: initialCreatedAt,
|
||||||
updatedAt: new Date().toISOString(),
|
updatedAt: new Date().toISOString(),
|
||||||
},
|
},
|
||||||
|
validate: false, // TODO remove!
|
||||||
})
|
})
|
||||||
|
|
||||||
await invalidateQueries()
|
await invalidateQueries()
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import hairlineWidth = StyleSheet.hairlineWidth
|
|||||||
import {AppBskyGraphDefs} from '@atproto/api'
|
import {AppBskyGraphDefs} from '@atproto/api'
|
||||||
|
|
||||||
import {Menu_Stroke2_Corner0_Rounded as Menu} from '#/components/icons/Menu'
|
import {Menu_Stroke2_Corner0_Rounded as Menu} from '#/components/icons/Menu'
|
||||||
import {StarterPackAvatarsIcon} from '#/components/StarterPack/StarterPackAvatarsIcon'
|
import {StarterPackIcon} from '#/components/icons/StarterPackIcon'
|
||||||
|
|
||||||
export function ProfileSubpageHeader({
|
export function ProfileSubpageHeader({
|
||||||
isLoading,
|
isLoading,
|
||||||
@@ -34,7 +34,6 @@ export function ProfileSubpageHeader({
|
|||||||
isOwner,
|
isOwner,
|
||||||
creator,
|
creator,
|
||||||
avatarType,
|
avatarType,
|
||||||
starterPack,
|
|
||||||
children,
|
children,
|
||||||
}: React.PropsWithChildren<{
|
}: React.PropsWithChildren<{
|
||||||
isLoading?: boolean
|
isLoading?: boolean
|
||||||
@@ -133,7 +132,7 @@ export function ProfileSubpageHeader({
|
|||||||
accessibilityHint=""
|
accessibilityHint=""
|
||||||
style={{width: 58}}>
|
style={{width: 58}}>
|
||||||
{avatarType === 'starter-pack' ? (
|
{avatarType === 'starter-pack' ? (
|
||||||
<StarterPackAvatarsIcon starterPack={starterPack} />
|
<StarterPackIcon width={58} height={58} />
|
||||||
) : (
|
) : (
|
||||||
<UserAvatar type={avatarType} size={58} avatar={avatar} />
|
<UserAvatar type={avatarType} size={58} avatar={avatar} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user