diff --git a/src/lib/routes/types.ts b/src/lib/routes/types.ts index 12ff2707..b1dcbb99 100644 --- a/src/lib/routes/types.ts +++ b/src/lib/routes/types.ts @@ -22,7 +22,7 @@ export type CommonNavigatorParams = { AppPasswords: undefined SavedFeeds: undefined PinnedFeeds: undefined - CustomFeed: {name?: string; rkey: string} + CustomFeed: {name: string; rkey: string; displayName?: string} MutedAccounts: undefined BlockedAccounts: undefined } diff --git a/src/view/com/algos/AlgoItem.tsx b/src/view/com/algos/AlgoItem.tsx index b28545c1..f2c36d7e 100644 --- a/src/view/com/algos/AlgoItem.tsx +++ b/src/view/com/algos/AlgoItem.tsx @@ -18,6 +18,7 @@ import {NavigationProp} from 'lib/routes/types' import {useStores} from 'state/index' import {HeartIconSolid} from 'lib/icons' import {pluralize} from 'lib/strings/helpers' +import {AtUri} from '@atproto/api' const AlgoItem = observer( ({ @@ -48,8 +49,11 @@ const AlgoItem = observer( style={[styles.container, style]} onPress={() => { navigation.navigate('CustomFeed', { - name: item.data.displayName, - rkey: item.data.uri, + name: item.data.creator.did, + rkey: new AtUri(item.data.uri).rkey, + displayName: + item.data.displayName ?? + `${item.data.creator.displayName}'s feed`, }) }} key={item.data.uri}> diff --git a/src/view/com/posts/Feed.tsx b/src/view/com/posts/Feed.tsx index 998cfe0c..443cf70b 100644 --- a/src/view/com/posts/Feed.tsx +++ b/src/view/com/posts/Feed.tsx @@ -34,6 +34,7 @@ export const Feed = observer(function Feed({ renderEmptyState, testID, headerOffset = 0, + ListHeaderComponent, }: { feed: PostsFeedModel style?: StyleProp @@ -44,6 +45,7 @@ export const Feed = observer(function Feed({ renderEmptyState?: () => JSX.Element testID?: string headerOffset?: number + ListHeaderComponent?: () => JSX.Element }) { const pal = usePalette('default') const {track} = useAnalytics() @@ -163,6 +165,7 @@ export const Feed = observer(function Feed({ keyExtractor={item => item._reactKey} renderItem={renderItem} ListFooterComponent={FeedFooter} + ListHeaderComponent={ListHeaderComponent} refreshControl={ export const CustomFeed = withAuthRequired( observer(({route}: Props) => { const rootStore = useStores() - const {rkey, name} = route.params + const {rkey, name, displayName} = route.params const currentFeed = useCustomFeed(rkey) const pal = usePalette('default') - const scrollElRef = useRef(null) - const algoFeed: PostsFeedModel = useMemo(() => { + const uri = makeRecordUri(name, 'app.bsky.feed.generator', rkey) const feed = new PostsFeedModel(rootStore, 'custom', { - feed: rkey, + feed: uri, }) feed.setup() return feed - }, [rkey, rootStore]) + }, [rkey, rootStore, name]) + + console.log(currentFeed?.data.creator) + + const _ListHeaderComponent = () => { + return ( + + + + + + + @{currentFeed?.data.creator.handle} + + + + {currentFeed?.data.description} + + + +