Add 'posts & replies' view to profiles

zio/stable
Paul Frazee 2022-11-22 12:26:53 -06:00
parent d608d67bfe
commit eaa2105570
3 changed files with 17 additions and 2 deletions

View File

@ -196,6 +196,10 @@ export class FeedModel {
return this.hasLoaded && !this.hasContent return this.hasLoaded && !this.hasContent
} }
get nonReplyFeed() {
return this.feed.filter(post => !post.record.reply)
}
setHasNewLatest(v: boolean) { setHasNewLatest(v: boolean) {
this.hasNewLatest = v this.hasNewLatest = v
} }

View File

@ -7,12 +7,17 @@ import {FeedModel} from './feed-view'
export enum Sections { export enum Sections {
Posts = 'Posts', Posts = 'Posts',
PostsWithReplies = 'Posts & replies',
Scenes = 'Scenes', Scenes = 'Scenes',
Trending = 'Trending', Trending = 'Trending',
Members = 'Members', 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] const SCENE_SELECTOR_ITEMS = [Sections.Trending, Sections.Members]
export interface ProfileUiParams { export interface ProfileUiParams {
@ -53,6 +58,7 @@ export class ProfileUiModel {
get currentView(): FeedModel | MembershipsViewModel | MembersViewModel { get currentView(): FeedModel | MembershipsViewModel | MembersViewModel {
if ( if (
this.selectedView === Sections.Posts || this.selectedView === Sections.Posts ||
this.selectedView === Sections.PostsWithReplies ||
this.selectedView === Sections.Trending this.selectedView === Sections.Trending
) { ) {
return this.feed return this.feed

View File

@ -121,10 +121,15 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => {
} else { } else {
if ( if (
uiState.selectedView === Sections.Posts || uiState.selectedView === Sections.Posts ||
uiState.selectedView === Sections.PostsWithReplies ||
uiState.selectedView === Sections.Trending uiState.selectedView === Sections.Trending
) { ) {
if (uiState.feed.hasContent) { 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) { if (!uiState.feed.hasMore) {
items.push(END_ITEM) items.push(END_ITEM)
} }