Clean homepage and export copy/paste issues, (no functional change)

This commit is contained in:
infinite-persistence 2022-04-08 17:20:30 +08:00
parent b79b7f9bde
commit 5a400ca2fa
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
4 changed files with 21 additions and 31 deletions

View file

@ -8,7 +8,7 @@ import { selectActiveLivestreams } from 'redux/selectors/livestream';
import { selectFollowedTags } from 'redux/selectors/tags'; import { selectFollowedTags } from 'redux/selectors/tags';
import { doToggleTagFollowDesktop } from 'redux/actions/tags'; import { doToggleTagFollowDesktop } from 'redux/actions/tags';
import { selectClientSetting, selectLanguage } from 'redux/selectors/settings'; import { selectClientSetting, selectLanguage } from 'redux/selectors/settings';
import Tags from './view'; import DiscoverPage from './view';
const select = (state, props) => { const select = (state, props) => {
const urlParams = new URLSearchParams(props.location.search); const urlParams = new URLSearchParams(props.location.search);
@ -30,4 +30,4 @@ export default connect(select, {
doToggleTagFollowDesktop, doToggleTagFollowDesktop,
doResolveUri, doResolveUri,
doFetchActiveLivestreams, doFetchActiveLivestreams,
})(Tags); })(DiscoverPage);

View file

@ -9,7 +9,7 @@ import { selectHasOdyseeMembership, selectHomepageFetched, selectUserVerifiedEma
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';
import DiscoverPage from './view'; import HomePage from './view';
const select = (state) => ({ const select = (state) => ({
followedTags: selectFollowedTags(state), followedTags: selectFollowedTags(state),
@ -31,4 +31,4 @@ const perform = (dispatch) => ({
doOpenModal: (modal, props) => dispatch(doOpenModal(modal, props)), doOpenModal: (modal, props) => dispatch(doOpenModal(modal, props)),
}); });
export default connect(select, perform)(DiscoverPage); export default connect(select, perform)(HomePage);

View file

@ -21,9 +21,12 @@ import classnames from 'classnames';
import Ads from 'web/component/ads'; import Ads from 'web/component/ads';
import Meme from 'web/component/meme'; import Meme from 'web/component/meme';
function resolveTitleOverride(title: string) { const FYP_SECTION: RowDataItem = {
return title === 'Recent From Following' ? 'Following' : title; id: 'FYP',
} title: 'Recommended',
icon: ICONS.GLOBE,
link: `/$/${PAGES.FYP}`,
};
type HomepageOrder = { active: ?Array<string>, hidden: ?Array<string> }; type HomepageOrder = { active: ?Array<string>, hidden: ?Array<string> };
@ -89,12 +92,7 @@ function HomePage(props: Props) {
if (item) { if (item) {
sortedRowData.push(item); sortedRowData.push(item);
} else if (key === 'FYP') { } else if (key === 'FYP') {
sortedRowData.push({ sortedRowData.push(FYP_SECTION);
id: 'FYP',
title: 'Recommended',
icon: ICONS.GLOBE,
link: `/$/${PAGES.FYP}`,
});
} }
}); });
} else { } else {
@ -102,13 +100,9 @@ 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);
hasMembership && if (hasMembership) {
sortedRowData.push({ sortedRowData.push(FYP_SECTION);
id: 'FYP', }
title: 'Recommended',
icon: ICONS.GLOBE,
link: `/$/${PAGES.FYP}`,
});
} else if (key.id !== 'NEWS') { } else if (key.id !== 'NEWS') {
sortedRowData.push(key); sortedRowData.push(key);
} }
@ -173,6 +167,10 @@ function HomePage(props: Props) {
); );
const HeaderArea = () => { const HeaderArea = () => {
function resolveTitleOverride(title: string) {
return title === 'Recent From Following' ? 'Following' : title;
}
return ( return (
<> <>
{title && typeof title === 'string' && ( {title && typeof title === 'string' && (

View file

@ -1,18 +1,10 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { selectFollowedTags } from 'redux/selectors/tags'; import TagsFollowingPage from './view';
import { selectUserVerifiedEmail } from 'redux/selectors/user';
import { selectSubscriptions } from 'redux/selectors/subscriptions';
import DiscoverPage from './view';
import { selectClientSetting } from 'redux/selectors/settings';
import * as SETTINGS from 'constants/settings'; import * as SETTINGS from 'constants/settings';
import { selectClientSetting } from 'redux/selectors/settings';
const select = (state) => ({ const select = (state) => ({
followedTags: selectFollowedTags(state),
subscribedChannels: selectSubscriptions(state),
email: selectUserVerifiedEmail(state),
tileLayout: selectClientSetting(state, SETTINGS.TILE_LAYOUT), tileLayout: selectClientSetting(state, SETTINGS.TILE_LAYOUT),
}); });
const perform = {}; export default connect(select)(TagsFollowingPage);
export default connect(select, perform)(DiscoverPage);