mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-18 10:52:16 +03:00
updated custom tabs store to support profile and own profile tabs
This commit is contained in:
parent
715b0aff35
commit
e0a3dddd3a
@ -10,7 +10,7 @@ import { getDefaultFilters, getFilterMap } from '../../constants/options/filters
|
||||
|
||||
import { ThemeContainer } from '../../containers';
|
||||
import { useAppSelector } from '../../hooks';
|
||||
import { setCommunityTabs, setMainTabs } from '../../redux/actions/customTabsAction';
|
||||
import { setCommunityTabs, setMainTabs, setOwnProfileTabs, setProfileTabs } from '../../redux/actions/customTabsAction';
|
||||
import { TextButton } from '../buttons';
|
||||
import styles from './customiseFiltersModalStyles';
|
||||
|
||||
@ -20,7 +20,7 @@ export interface CustomiseFiltersModalRef {
|
||||
}
|
||||
|
||||
interface Props {
|
||||
pageType:'main'|'community'
|
||||
pageType:'main'|'community'|'profile'|'ownProfile'
|
||||
}
|
||||
|
||||
|
||||
@ -44,6 +44,8 @@ const CustomiseFiltersModal = ({pageType}:Props, ref:Ref<CustomiseFiltersModalRe
|
||||
switch (pageType){
|
||||
case 'community': return state.customTabs.communityTabs || defaultFilters;
|
||||
case 'main': return state.customTabs.mainTabs || defaultFilters;
|
||||
case 'profile': return state.customTabs.profileTabs || defaultFilters;
|
||||
case 'ownProfile': return state.customTabs.ownProfileTabs || defaultFilters;
|
||||
default: return state.customTabs.mainTabs || defaultFilters;
|
||||
}
|
||||
});
|
||||
@ -96,6 +98,12 @@ const CustomiseFiltersModal = ({pageType}:Props, ref:Ref<CustomiseFiltersModalRe
|
||||
case 'community':
|
||||
dispatch(setCommunityTabs(entries));
|
||||
break;
|
||||
case 'profile':
|
||||
dispatch(setProfileTabs(entries));
|
||||
break;
|
||||
case 'ownProfile':
|
||||
dispatch(setOwnProfileTabs(entries));
|
||||
break;
|
||||
}
|
||||
_onClose();
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ export const StackedTabBar = ({
|
||||
|
||||
{enableCustomTabs && (
|
||||
<CustomiseFiltersModal
|
||||
pageType={pageType}
|
||||
pageType={'ownProfile'}
|
||||
ref={customiseModalRef}
|
||||
/>
|
||||
)}
|
||||
|
@ -1,4 +1,7 @@
|
||||
export const DEFAULT_FEED_FILTERS = ['friends', 'communities', 'hot'];
|
||||
export const DEFAULT_COMMUNITY_FILTERS = ['trending', 'hot', 'created'];
|
||||
export const DEFAULT_PROFILE_FILTERS = ['blog', 'posts', 'comments'];
|
||||
export const DEFAULT_OWN_PROFILE_FILTERS = ['blog', 'posts', 'replies']
|
||||
|
||||
export const FEED_SCREEN_FILTER_MAP = {
|
||||
friends:'home.friends',
|
||||
@ -8,7 +11,6 @@ export const FEED_SCREEN_FILTER_MAP = {
|
||||
created:'home.new',
|
||||
}
|
||||
|
||||
export const DEFAULT_COMMUNITY_FILTERS = ['trending', 'hot', 'created'];
|
||||
export const COMMUNITY_SCREEN_FILTER_MAP = {
|
||||
trending:'home.top',
|
||||
hot: 'home.hot',
|
||||
@ -17,6 +19,15 @@ export const COMMUNITY_SCREEN_FILTER_MAP = {
|
||||
payout: 'community.payout'
|
||||
}
|
||||
|
||||
export const PROFILE_SCREEN_FILTER_MAP = {
|
||||
blog:'home.blog',
|
||||
posts:'home.posts',
|
||||
comments:'profile.comments',
|
||||
replies:'profile.replies',
|
||||
wallet:'profile.wallet'
|
||||
}
|
||||
|
||||
|
||||
|
||||
export const GLOBAL_POST_FILTERS = ['home.TOP', 'home.HOT', 'home.NEW'];
|
||||
export const GLOBAL_POST_FILTERS_VALUE = ['trending', 'hot', 'created'];
|
||||
@ -25,16 +36,22 @@ export const PROFILE_FILTERS_OWN = ['home.BLOG', 'home.POSTS', 'profile.replies'
|
||||
export const PROFILE_FILTERS = ['home.BLOG', 'home.POSTS', 'profile.comments', 'profile.wallet'];
|
||||
export const PROFILE_FILTERS_VALUE = ['blog', 'posts', 'comments', 'wallet'];
|
||||
|
||||
export const getFilterMap = (type:'main'|'community') => {
|
||||
|
||||
|
||||
export const getFilterMap = (type:'main'|'community'|'profile'|'ownProfile') => {
|
||||
switch(type){
|
||||
case 'community': return COMMUNITY_SCREEN_FILTER_MAP;
|
||||
case 'main': return FEED_SCREEN_FILTER_MAP
|
||||
case 'main': return FEED_SCREEN_FILTER_MAP;
|
||||
case 'profile': return PROFILE_SCREEN_FILTER_MAP;
|
||||
case 'ownProfile': return PROFILE_SCREEN_FILTER_MAP
|
||||
}
|
||||
}
|
||||
|
||||
export const getDefaultFilters = (type:'main'|'community') => {
|
||||
export const getDefaultFilters = (type:'main'|'community'|'profile'|'ownProfile') => {
|
||||
switch(type){
|
||||
case 'community': return DEFAULT_COMMUNITY_FILTERS;
|
||||
case 'main': return DEFAULT_FEED_FILTERS
|
||||
case 'main': return DEFAULT_FEED_FILTERS;
|
||||
case 'profile': return DEFAULT_PROFILE_FILTERS;
|
||||
case 'ownProfile': return DEFAULT_OWN_PROFILE_FILTERS;
|
||||
}
|
||||
}
|
@ -92,6 +92,7 @@ class ProfileContainer extends Component {
|
||||
} = this.props;
|
||||
this.setState({ isProfileLoading: true });
|
||||
let repliesAction;
|
||||
|
||||
if (!isOwnProfile) {
|
||||
repliesAction = getAccountPosts;
|
||||
if (query) {
|
||||
@ -129,6 +130,8 @@ class ProfileContainer extends Component {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (query) {
|
||||
delete query.author;
|
||||
delete query.permlink;
|
||||
|
@ -1,6 +1,8 @@
|
||||
import {
|
||||
SET_COMMUNITY_TABS,
|
||||
SET_MAIN_TABS
|
||||
SET_MAIN_TABS,
|
||||
SET_OWN_PROFILE_TABS,
|
||||
SET_PROFILE_TABS
|
||||
} from '../constants/constants';
|
||||
|
||||
|
||||
@ -9,10 +11,19 @@ import {
|
||||
type: SET_MAIN_TABS
|
||||
})
|
||||
|
||||
|
||||
export const setCommunityTabs = (payload:string[]) => ({
|
||||
payload,
|
||||
type: SET_COMMUNITY_TABS
|
||||
})
|
||||
|
||||
export const setProfileTabs = (payload:string[]) => ({
|
||||
payload,
|
||||
type: SET_PROFILE_TABS
|
||||
})
|
||||
|
||||
export const setOwnProfileTabs = (payload:string[]) => ({
|
||||
payload,
|
||||
type: SET_OWN_PROFILE_TABS
|
||||
})
|
||||
|
||||
|
@ -95,3 +95,5 @@ export const FETCH_LEADERBOARD_FAIL = 'FETCH_LEADERBOARD_FAIL';
|
||||
//CUSTOM TABS
|
||||
export const SET_MAIN_TABS = 'SET_MAIN_TABS';
|
||||
export const SET_COMMUNITY_TABS = 'SET_COMMUNITY_TABS';
|
||||
export const SET_PROFILE_TABS = 'SET_PROFILE_TABS';
|
||||
export const SET_OWN_PROFILE_TABS = 'SET_OWN_PROFILE_TABS';
|
||||
|
@ -1,17 +1,23 @@
|
||||
import { DEFAULT_COMMUNITY_FILTERS, DEFAULT_FEED_FILTERS } from '../../constants/options/filters';
|
||||
import { DEFAULT_COMMUNITY_FILTERS, DEFAULT_FEED_FILTERS, DEFAULT_OWN_PROFILE_FILTERS, DEFAULT_PROFILE_FILTERS } from '../../constants/options/filters';
|
||||
import {
|
||||
SET_COMMUNITY_TABS,
|
||||
SET_MAIN_TABS,
|
||||
SET_OWN_PROFILE_TABS,
|
||||
SET_PROFILE_TABS,
|
||||
} from '../constants/constants';
|
||||
|
||||
interface State {
|
||||
communityTabs:string[],
|
||||
mainTabs:string[],
|
||||
profileTabs:string[],
|
||||
ownProfileTabs:string[]
|
||||
}
|
||||
|
||||
const initialState:State = {
|
||||
communityTabs: DEFAULT_COMMUNITY_FILTERS,
|
||||
mainTabs:DEFAULT_FEED_FILTERS
|
||||
mainTabs:DEFAULT_FEED_FILTERS,
|
||||
profileTabs:DEFAULT_PROFILE_FILTERS,
|
||||
ownProfileTabs:DEFAULT_OWN_PROFILE_FILTERS
|
||||
};
|
||||
|
||||
export default function (state:State = initialState, action):State {
|
||||
@ -28,6 +34,18 @@ export default function (state:State = initialState, action):State {
|
||||
...state,
|
||||
communityTabs: action.payload
|
||||
}
|
||||
|
||||
case SET_PROFILE_TABS:
|
||||
return {
|
||||
...state,
|
||||
profileTabs: action.payload
|
||||
}
|
||||
|
||||
case SET_OWN_PROFILE_TABS:
|
||||
return {
|
||||
...state,
|
||||
ownProfileTabs: action.payload
|
||||
}
|
||||
|
||||
default:
|
||||
return state;
|
||||
|
Loading…
Reference in New Issue
Block a user