Implement popular & following views on home screen

This commit is contained in:
Paul Frazee
2023-03-16 21:47:11 -05:00
parent ad9da82612
commit 71209bb3ac
6 changed files with 273 additions and 163 deletions
+11 -1
View File
@@ -257,7 +257,7 @@ export class FeedModel {
constructor(
public rootStore: RootStoreModel,
public feedType: 'home' | 'author' | 'suggested',
public feedType: 'home' | 'author' | 'suggested' | 'goodstuff',
params: GetTimeline.QueryParams | GetAuthorFeed.QueryParams,
) {
makeAutoObservable(
@@ -634,6 +634,16 @@ export class FeedModel {
return this.rootStore.api.app.bsky.feed.getTimeline(
params as GetTimeline.QueryParams,
)
} else if (this.feedType === 'goodstuff') {
const res = await this.rootStore.api.app.bsky.feed.getAuthorFeed({
...params,
author: 'jay.bsky.social',
} as GetAuthorFeed.QueryParams)
res.data.feed = mergePosts([res], {repostsOnly: true})
res.data.feed.forEach(item => {
delete item.reason
})
return res
} else {
return this.rootStore.api.app.bsky.feed.getAuthorFeed(
params as GetAuthorFeed.QueryParams,