From deb7c1bba743b9c3139dd78f8cf35c5bf0db034e Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Tue, 22 Nov 2022 12:26:53 -0600 Subject: [PATCH] Add 'posts & replies' view to profiles --- src/state/models/feed-view.ts | 4 ++++ src/state/models/profile-ui.ts | 8 +++++++- src/view/screens/Profile.tsx | 7 ++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/state/models/feed-view.ts b/src/state/models/feed-view.ts index 202476fa38..7b27b239b1 100644 --- a/src/state/models/feed-view.ts +++ b/src/state/models/feed-view.ts @@ -196,6 +196,10 @@ export class FeedModel { return this.hasLoaded && !this.hasContent } + get nonReplyFeed() { + return this.feed.filter(post => !post.record.reply) + } + setHasNewLatest(v: boolean) { this.hasNewLatest = v } diff --git a/src/state/models/profile-ui.ts b/src/state/models/profile-ui.ts index 0a70525fa3..d0eb1f8582 100644 --- a/src/state/models/profile-ui.ts +++ b/src/state/models/profile-ui.ts @@ -7,12 +7,17 @@ import {FeedModel} from './feed-view' export enum Sections { Posts = 'Posts', + PostsWithReplies = 'Posts & replies', Scenes = 'Scenes', Trending = 'Trending', Members = 'Members', } -const USER_SELECTOR_ITEMS = [Sections.Posts, Sections.Scenes] +const USER_SELECTOR_ITEMS = [ + Sections.Posts, + Sections.PostsWithReplies, + Sections.Scenes, +] const SCENE_SELECTOR_ITEMS = [Sections.Trending, Sections.Members] export interface ProfileUiParams { @@ -53,6 +58,7 @@ export class ProfileUiModel { get currentView(): FeedModel | MembershipsViewModel | MembersViewModel { if ( this.selectedView === Sections.Posts || + this.selectedView === Sections.PostsWithReplies || this.selectedView === Sections.Trending ) { return this.feed diff --git a/src/view/screens/Profile.tsx b/src/view/screens/Profile.tsx index 1187e626e2..d1abcd7314 100644 --- a/src/view/screens/Profile.tsx +++ b/src/view/screens/Profile.tsx @@ -121,10 +121,15 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => { } else { if ( uiState.selectedView === Sections.Posts || + uiState.selectedView === Sections.PostsWithReplies || uiState.selectedView === Sections.Trending ) { if (uiState.feed.hasContent) { - items = uiState.feed.feed.slice() + if (uiState.selectedView === Sections.Posts) { + items = uiState.feed.nonReplyFeed + } else { + items = uiState.feed.feed.slice() + } if (!uiState.feed.hasMore) { items.push(END_ITEM) }