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
}
get nonReplyFeed() {
return this.feed.filter(post => !post.record.reply)
}
setHasNewLatest(v: boolean) {
this.hasNewLatest = v
}

View File

@ -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

View File

@ -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)
}