split profiles into profile and ownProfile page types

This commit is contained in:
Nouman Tahir 2021-05-18 15:53:08 +05:00
parent acf4fab4bf
commit 745eb2805c
6 changed files with 15 additions and 16 deletions

View File

@ -477,7 +477,7 @@ const PostsContainer = ({
};
const _getPromotePosts = async () => {
if (pageType === 'profiles') {
if (pageType === 'profile' || pageType === 'ownProfile') {
return;
}
await getPromotePosts()
@ -585,7 +585,10 @@ const PostsContainer = ({
sort: filter,
};
if (pageType === 'profiles' && (filter === 'feed' || filter === 'posts')) {
if (
(pageType === 'profile' || pageType === 'ownProfile') &&
(filter === 'feed' || filter === 'posts')
) {
options.sort = 'posts';
}
}

View File

@ -1,8 +1,7 @@
import React, { PureComponent, Fragment } from 'react';
import { View, ScrollView, SafeAreaView, Text } from 'react-native';
import React, { PureComponent } from 'react';
import { View, ScrollView } from 'react-native';
import { injectIntl } from 'react-intl';
import get from 'lodash/get';
import ScrollableTabView from 'react-native-scrollable-tab-view';
// Components
import { CollapsibleCard } from '../collapsibleCard';
@ -10,7 +9,6 @@ import { Comments } from '../comments';
import { Header } from '../header';
import { NoPost, ProfileSummaryPlaceHolder, WalletDetailsPlaceHolder } from '../basicUIElements';
import { ProfileSummary } from '../profileSummary';
import { TabBar } from '../tabBar';
import { Wallet } from '../wallet';
// Constants
@ -18,8 +16,6 @@ import {
PROFILE_FILTERS,
PROFILE_FILTERS_OWN,
PROFILE_FILTERS_VALUE,
PROFILE_SUBFILTERS,
PROFILE_SUBFILTERS_VALUE,
} from '../../constants/options/filters';
// Utils
@ -27,7 +23,7 @@ import { getFormatedCreatedDate } from '../../utils/time';
// Styles
import styles from './profileStyles';
import globalStyles from '../../globalStyles';
import { TabbedPosts } from '../tabbedPosts';
class ProfileView extends PureComponent {
@ -244,7 +240,7 @@ class ProfileView extends PureComponent {
filterOptions={filterOptions}
filterOptionsValue={PROFILE_FILTERS_VALUE}
selectedOptionIndex={0}
pageType="profiles"
pageType={isOwnProfile ? 'ownProfile' : 'profile'}
getFor="blog"
feedUsername={username}
key={username}

View File

@ -85,7 +85,7 @@ export const loadPosts = async ({
sort: filter,
};
if (pageType === 'profiles' && (filter === 'feed' || filter === 'posts')) {
if ((pageType === 'profile' || pageType === 'ownProfile') && (filter === 'feed' || filter === 'posts')) {
options.sort = 'posts';
}
}

View File

@ -8,7 +8,7 @@ export interface TabbedPostsProps {
feedSubfilterOptions:string[],
feedSubfilterOptionsValue:string[],
getFor:string,
pageType:'main'|'community'|'profiles',
pageType:'main'|'community'|'profile'|'ownProfile',
tag:string,
forceLoadPosts:boolean,
tabContentOverrides:Map<number, any>,

View File

@ -14,7 +14,7 @@ interface StackedTabBarProps {
activeTab:boolean;
goToPage:(pageIndex)=>void;
tabs:string[];
pageType?:'main'|'community'
pageType?:'main'|'community'|'profile'|'ownProfile'
shouldStack:boolean;
firstStack:TabItem[];
secondStack:TabItem[];
@ -47,7 +47,7 @@ export const StackedTabBar = ({
const [selectedFilterIndex, setSelectedFilterIndex] = useState(initialFirstStackIndex);
const [selectedSecondStackIndex, setSelectedSecondStackIndex] = useState(0);
const enableCustomTabs = pageType === 'main' || pageType === 'community';
const enableCustomTabs = pageType !== undefined;
const _onCustomisePress = () => {
@ -109,7 +109,7 @@ export const StackedTabBar = ({
{enableCustomTabs && (
<CustomiseFiltersModal
pageType={'ownProfile'}
pageType={pageType}
ref={customiseModalRef}
/>
)}

View File

@ -172,7 +172,7 @@ const TabContent = ({
const _getPromotedPosts = async () => {
if(pageType === 'profiles'){
if(pageType === 'profile' || pageType === 'ownProfile'){
return;
}
const pPosts = await getPromotedPosts(username)