add subscribed channels to not_channels on channel discovery page
This commit is contained in:
parent
efde2a2484
commit
ea8b63e96f
3 changed files with 27 additions and 14 deletions
|
@ -16,6 +16,7 @@ type Props = {
|
||||||
tags: Array<string>,
|
tags: Array<string>,
|
||||||
hiddenUris: Array<string>,
|
hiddenUris: Array<string>,
|
||||||
channelIds?: Array<string>,
|
channelIds?: Array<string>,
|
||||||
|
notChannelIds?: Array<string>,
|
||||||
pageSize: number,
|
pageSize: number,
|
||||||
orderBy?: Array<string>,
|
orderBy?: Array<string>,
|
||||||
releaseTime?: string,
|
releaseTime?: string,
|
||||||
|
@ -33,6 +34,7 @@ function ClaimTilesDiscover(props: Props) {
|
||||||
// Below are options to pass that are forwarded to claim_search
|
// Below are options to pass that are forwarded to claim_search
|
||||||
tags,
|
tags,
|
||||||
channelIds,
|
channelIds,
|
||||||
|
notChannelIds,
|
||||||
orderBy,
|
orderBy,
|
||||||
pageSize = 8,
|
pageSize = 8,
|
||||||
releaseTime,
|
releaseTime,
|
||||||
|
@ -61,8 +63,9 @@ function ClaimTilesDiscover(props: Props) {
|
||||||
not_tags: !showNsfw ? MATURE_TAGS : [],
|
not_tags: !showNsfw ? MATURE_TAGS : [],
|
||||||
channel_ids: channelIds || [],
|
channel_ids: channelIds || [],
|
||||||
not_channel_ids:
|
not_channel_ids:
|
||||||
|
notChannelIds ||
|
||||||
// If channelIds were passed in, we don't need not_channel_ids
|
// If channelIds were passed in, we don't need not_channel_ids
|
||||||
!channelIds && hiddenUris && hiddenUris.length ? hiddenUris.map(hiddenUri => hiddenUri.split('#')[1]) : [],
|
(!channelIds && hiddenUris && hiddenUris.length ? hiddenUris.map(hiddenUri => hiddenUri.split('#')[1]) : []),
|
||||||
order_by: orderBy || ['trending_group', 'trending_mixed'],
|
order_by: orderBy || ['trending_group', 'trending_mixed'],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,12 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { selectFollowedTags } from 'lbry-redux';
|
import { selectFollowedTags, selectBlockedChannels } from 'lbry-redux';
|
||||||
import { selectSubscriptions, selectSuggestedChannels } from 'redux/selectors/subscriptions';
|
import { selectSubscriptions } from 'redux/selectors/subscriptions';
|
||||||
import { doFetchRecommendedSubscriptions } from 'redux/actions/subscriptions';
|
|
||||||
import ChannelsFollowingManagePage from './view';
|
import ChannelsFollowingManagePage from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
followedTags: selectFollowedTags(state),
|
followedTags: selectFollowedTags(state),
|
||||||
subscribedChannels: selectSubscriptions(state),
|
subscribedChannels: selectSubscriptions(state),
|
||||||
suggestedSubscriptions: selectSuggestedChannels(state),
|
blockedChannels: selectBlockedChannels(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(select)(ChannelsFollowingManagePage);
|
||||||
select,
|
|
||||||
{
|
|
||||||
doFetchRecommendedSubscriptions,
|
|
||||||
}
|
|
||||||
)(ChannelsFollowingManagePage);
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ import { toCapitalCase } from 'util/string';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
followedTags: Array<Tag>,
|
followedTags: Array<Tag>,
|
||||||
|
subscribedChannels: Array<Subscription>,
|
||||||
|
blockedChannels: Array<string>,
|
||||||
};
|
};
|
||||||
|
|
||||||
type RowDataItem = {
|
type RowDataItem = {
|
||||||
|
@ -19,8 +21,12 @@ type RowDataItem = {
|
||||||
};
|
};
|
||||||
|
|
||||||
function ChannelsFollowingDiscover(props: Props) {
|
function ChannelsFollowingDiscover(props: Props) {
|
||||||
const { followedTags } = props;
|
const { followedTags, subscribedChannels, blockedChannels } = props;
|
||||||
let rowData: Array<RowDataItem> = [];
|
let rowData: Array<RowDataItem> = [];
|
||||||
|
const notChannels = subscribedChannels
|
||||||
|
.map(({ uri }) => uri)
|
||||||
|
.concat(blockedChannels)
|
||||||
|
.map(uri => uri.split('#')[1]);
|
||||||
|
|
||||||
rowData.push({
|
rowData.push({
|
||||||
title: 'Top Channels Of All Time',
|
title: 'Top Channels Of All Time',
|
||||||
|
@ -52,7 +58,7 @@ function ChannelsFollowingDiscover(props: Props) {
|
||||||
|
|
||||||
if (followedTags.length > 0 && followedTags.length < 5) {
|
if (followedTags.length > 0 && followedTags.length < 5) {
|
||||||
const followedRows = followedTags.map((tag: Tag) => ({
|
const followedRows = followedTags.map((tag: Tag) => ({
|
||||||
title: `Trending for #${toCapitalCase(tag.name)}`,
|
title: `Trending Channels for #${toCapitalCase(tag.name)}`,
|
||||||
link: `/$/${PAGES.TAGS}?t=${tag.name}`,
|
link: `/$/${PAGES.TAGS}?t=${tag.name}`,
|
||||||
options: {
|
options: {
|
||||||
claimType: 'channel',
|
claimType: 'channel',
|
||||||
|
@ -74,9 +80,19 @@ function ChannelsFollowingDiscover(props: Props) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const rowDataWithGenericOptions = rowData.map(row => {
|
||||||
|
return {
|
||||||
|
...row,
|
||||||
|
options: {
|
||||||
|
...row.options,
|
||||||
|
notChannels,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page>
|
<Page>
|
||||||
{rowData.map(({ title, link, help, options = {} }) => (
|
{rowDataWithGenericOptions.map(({ title, link, help, options = {} }) => (
|
||||||
<div key={title} className="claim-grid__wrapper">
|
<div key={title} className="claim-grid__wrapper">
|
||||||
<h1 className="section__actions">
|
<h1 className="section__actions">
|
||||||
{link ? (
|
{link ? (
|
||||||
|
|
Loading…
Reference in a new issue