From 71209bb3aca1104773ee9fab20ec9f9ab4fc3ad2 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Thu, 16 Mar 2023 21:47:11 -0500 Subject: [PATCH] Implement popular & following views on home screen --- src/state/models/feed-view.ts | 12 +- src/view/com/profile/FollowButton.tsx | 2 +- src/view/com/util/Pager.tsx | 27 +- src/view/com/util/PostMeta.tsx | 8 +- src/view/com/util/TabBar.tsx | 25 +- src/view/screens/Home.tsx | 362 +++++++++++++++++--------- 6 files changed, 273 insertions(+), 163 deletions(-) diff --git a/src/state/models/feed-view.ts b/src/state/models/feed-view.ts index 42b753b2..81760132 100644 --- a/src/state/models/feed-view.ts +++ b/src/state/models/feed-view.ts @@ -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, diff --git a/src/view/com/profile/FollowButton.tsx b/src/view/com/profile/FollowButton.tsx index f24c3d0c..7a194cee 100644 --- a/src/view/com/profile/FollowButton.tsx +++ b/src/view/com/profile/FollowButton.tsx @@ -42,7 +42,7 @@ const FollowButton = observer( return (