fix recommended showing blank on homepage

This commit is contained in:
Thomas Zarebczan 2022-03-28 10:01:55 -04:00
parent 726dc77943
commit 157b6d3f19
No known key found for this signature in database
GPG key ID: 767B41E1BB7346F2
2 changed files with 11 additions and 7 deletions

View file

@ -5,7 +5,7 @@ import { doFetchActiveLivestreams } from 'redux/actions/livestream';
import { selectAdBlockerFound } from 'redux/selectors/app'; import { selectAdBlockerFound } from 'redux/selectors/app';
import { selectActiveLivestreams, selectFetchingActiveLivestreams } from 'redux/selectors/livestream'; import { selectActiveLivestreams, selectFetchingActiveLivestreams } from 'redux/selectors/livestream';
import { selectFollowedTags } from 'redux/selectors/tags'; import { selectFollowedTags } from 'redux/selectors/tags';
import { selectUserVerifiedEmail } from 'redux/selectors/user'; import { selectHasOdyseeMembership, selectUserVerifiedEmail } from 'redux/selectors/user';
import { selectSubscriptions } from 'redux/selectors/subscriptions'; import { selectSubscriptions } from 'redux/selectors/subscriptions';
import { selectShowMatureContent, selectHomepageData, selectClientSetting } from 'redux/selectors/settings'; import { selectShowMatureContent, selectHomepageData, selectClientSetting } from 'redux/selectors/settings';
@ -22,6 +22,7 @@ const select = (state) => ({
hideScheduledLivestreams: selectClientSetting(state, SETTINGS.HIDE_SCHEDULED_LIVESTREAMS), hideScheduledLivestreams: selectClientSetting(state, SETTINGS.HIDE_SCHEDULED_LIVESTREAMS),
adBlockerFound: selectAdBlockerFound(state), adBlockerFound: selectAdBlockerFound(state),
homepageOrder: selectClientSetting(state, SETTINGS.HOMEPAGE_ORDER), homepageOrder: selectClientSetting(state, SETTINGS.HOMEPAGE_ORDER),
hasMembership: selectHasOdyseeMembership(state),
}); });
const perform = (dispatch) => ({ const perform = (dispatch) => ({

View file

@ -40,6 +40,7 @@ type Props = {
adBlockerFound: ?boolean, adBlockerFound: ?boolean,
homepageOrder: HomepageOrder, homepageOrder: HomepageOrder,
doOpenModal: (id: string, ?{}) => void, doOpenModal: (id: string, ?{}) => void,
hasMembership: boolean,
}; };
function HomePage(props: Props) { function HomePage(props: Props) {
@ -56,6 +57,7 @@ function HomePage(props: Props) {
adBlockerFound, adBlockerFound,
homepageOrder, homepageOrder,
doOpenModal, doOpenModal,
hasMembership,
} = props; } = props;
const showPersonalizedChannels = (authenticated || !IS_WEB) && subscribedChannels && subscribedChannels.length > 0; const showPersonalizedChannels = (authenticated || !IS_WEB) && subscribedChannels && subscribedChannels.length > 0;
@ -98,12 +100,13 @@ function HomePage(props: Props) {
// always inject FYP is homepage not customized, hide news. // always inject FYP is homepage not customized, hide news.
if (key.id === 'FOLLOWING') { if (key.id === 'FOLLOWING') {
sortedRowData.push(key); sortedRowData.push(key);
sortedRowData.push({ hasMembership &&
id: 'FYP', sortedRowData.push({
title: 'Recommended', id: 'FYP',
icon: ICONS.GLOBE, title: 'Recommended',
link: `/$/${PAGES.FYP}`, icon: ICONS.GLOBE,
}); link: `/$/${PAGES.FYP}`,
});
} else if (key.id !== 'NEWS') { } else if (key.id !== 'NEWS') {
sortedRowData.push(key); sortedRowData.push(key);
} }