From ea8b63e96f44dcff9762c1f3806ee36922ad02c2 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 18 Feb 2020 12:00:47 -0500 Subject: [PATCH] add subscribed channels to not_channels on channel discovery page --- ui/component/claimTilesDiscover/view.jsx | 5 ++++- ui/page/channelsFollowingDiscover/index.js | 14 ++++---------- ui/page/channelsFollowingDiscover/view.jsx | 22 +++++++++++++++++++--- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/ui/component/claimTilesDiscover/view.jsx b/ui/component/claimTilesDiscover/view.jsx index 1d297f558..5757143ff 100644 --- a/ui/component/claimTilesDiscover/view.jsx +++ b/ui/component/claimTilesDiscover/view.jsx @@ -16,6 +16,7 @@ type Props = { tags: Array, hiddenUris: Array, channelIds?: Array, + notChannelIds?: Array, pageSize: number, orderBy?: Array, releaseTime?: string, @@ -33,6 +34,7 @@ function ClaimTilesDiscover(props: Props) { // Below are options to pass that are forwarded to claim_search tags, channelIds, + notChannelIds, orderBy, pageSize = 8, releaseTime, @@ -61,8 +63,9 @@ function ClaimTilesDiscover(props: Props) { not_tags: !showNsfw ? MATURE_TAGS : [], channel_ids: channelIds || [], not_channel_ids: + notChannelIds || // 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'], }; diff --git a/ui/page/channelsFollowingDiscover/index.js b/ui/page/channelsFollowingDiscover/index.js index e749abcaf..dbfda416a 100644 --- a/ui/page/channelsFollowingDiscover/index.js +++ b/ui/page/channelsFollowingDiscover/index.js @@ -1,18 +1,12 @@ import { connect } from 'react-redux'; -import { selectFollowedTags } from 'lbry-redux'; -import { selectSubscriptions, selectSuggestedChannels } from 'redux/selectors/subscriptions'; -import { doFetchRecommendedSubscriptions } from 'redux/actions/subscriptions'; +import { selectFollowedTags, selectBlockedChannels } from 'lbry-redux'; +import { selectSubscriptions } from 'redux/selectors/subscriptions'; import ChannelsFollowingManagePage from './view'; const select = state => ({ followedTags: selectFollowedTags(state), subscribedChannels: selectSubscriptions(state), - suggestedSubscriptions: selectSuggestedChannels(state), + blockedChannels: selectBlockedChannels(state), }); -export default connect( - select, - { - doFetchRecommendedSubscriptions, - } -)(ChannelsFollowingManagePage); +export default connect(select)(ChannelsFollowingManagePage); diff --git a/ui/page/channelsFollowingDiscover/view.jsx b/ui/page/channelsFollowingDiscover/view.jsx index dc01afae6..5cfce421f 100644 --- a/ui/page/channelsFollowingDiscover/view.jsx +++ b/ui/page/channelsFollowingDiscover/view.jsx @@ -9,6 +9,8 @@ import { toCapitalCase } from 'util/string'; type Props = { followedTags: Array, + subscribedChannels: Array, + blockedChannels: Array, }; type RowDataItem = { @@ -19,8 +21,12 @@ type RowDataItem = { }; function ChannelsFollowingDiscover(props: Props) { - const { followedTags } = props; + const { followedTags, subscribedChannels, blockedChannels } = props; let rowData: Array = []; + const notChannels = subscribedChannels + .map(({ uri }) => uri) + .concat(blockedChannels) + .map(uri => uri.split('#')[1]); rowData.push({ title: 'Top Channels Of All Time', @@ -52,7 +58,7 @@ function ChannelsFollowingDiscover(props: Props) { if (followedTags.length > 0 && followedTags.length < 5) { 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}`, options: { claimType: 'channel', @@ -74,9 +80,19 @@ function ChannelsFollowingDiscover(props: Props) { }); } + const rowDataWithGenericOptions = rowData.map(row => { + return { + ...row, + options: { + ...row.options, + notChannels, + }, + }; + }); + return ( - {rowData.map(({ title, link, help, options = {} }) => ( + {rowDataWithGenericOptions.map(({ title, link, help, options = {} }) => (

{link ? (