add additional rows to channel discovery page

This commit is contained in:
Sean Yesmunt 2020-02-18 10:26:58 -05:00
parent f42a8f6db8
commit efde2a2484
2 changed files with 53 additions and 5 deletions

View file

@ -1,9 +1,11 @@
import { connect } from 'react-redux';
import { selectFollowedTags } from 'lbry-redux';
import { selectSubscriptions, selectSuggestedChannels } from 'redux/selectors/subscriptions';
import { doFetchRecommendedSubscriptions } from 'redux/actions/subscriptions';
import ChannelsFollowingManagePage from './view';
const select = state => ({
followedTags: selectFollowedTags(state),
subscribedChannels: selectSubscriptions(state),
suggestedSubscriptions: selectSuggestedChannels(state),
});

View file

@ -5,8 +5,11 @@ import React from 'react';
import Page from 'component/page';
import Button from 'component/button';
import ClaimTilesDiscover from 'component/claimTilesDiscover';
import { toCapitalCase } from 'util/string';
type Props = {};
type Props = {
followedTags: Array<Tag>,
};
type RowDataItem = {
title: string,
@ -16,18 +19,61 @@ type RowDataItem = {
};
function ChannelsFollowingDiscover(props: Props) {
const { followedTags } = props;
let rowData: Array<RowDataItem> = [];
rowData.push({
title: 'Top Channels On LBRY',
link: `/$/${PAGES.DISCOVER}`,
title: 'Top Channels Of All Time',
options: {
pageSize: 12,
pageSize: 8,
claimType: 'channel',
orderBy: ['trending_global', 'trending_mixed'],
orderBy: ['effective_amount'],
},
});
rowData.push({
title: 'Latest From @lbrycast',
link: `/@lbrycast:4`,
options: {
orderBy: ['release_time'],
pageSize: 8,
channelIds: ['4c29f8b013adea4d5cca1861fb2161d5089613ea'],
},
});
rowData.push({
title: 'Trending Channels',
options: {
pageSize: 4,
claimType: 'channel',
orderBy: ['trending_group', 'trending_mixed'],
},
});
if (followedTags.length > 0 && followedTags.length < 5) {
const followedRows = followedTags.map((tag: Tag) => ({
title: `Trending for #${toCapitalCase(tag.name)}`,
link: `/$/${PAGES.TAGS}?t=${tag.name}`,
options: {
claimType: 'channel',
pageSize: 4,
tags: [tag.name],
},
}));
rowData.push(...followedRows);
}
if (followedTags.length > 4) {
rowData.push({
title: 'Trending For Your Tags',
link: `/$/${PAGES.TAGS_FOLLOWING}`,
options: {
claimType: 'channel',
tags: followedTags.map(tag => tag.name),
},
});
}
return (
<Page>
{rowData.map(({ title, link, help, options = {} }) => (