diff --git a/src/renderer/component/recommendedVideos/index.js b/src/renderer/component/recommendedContent/index.js similarity index 100% rename from src/renderer/component/recommendedVideos/index.js rename to src/renderer/component/recommendedContent/index.js diff --git a/src/renderer/component/recommendedVideos/view.jsx b/src/renderer/component/recommendedContent/view.jsx similarity index 56% rename from src/renderer/component/recommendedVideos/view.jsx rename to src/renderer/component/recommendedContent/view.jsx index 9236f42f0..0d478e761 100644 --- a/src/renderer/component/recommendedVideos/view.jsx +++ b/src/renderer/component/recommendedContent/view.jsx @@ -4,8 +4,10 @@ import FileTile from 'component/fileTile'; import { FormRow, FormField } from 'component/common/form'; import ToolTip from 'component/common/tooltip'; import type { Claim } from 'types/claim'; +import { buildURI, parseURI } from 'lbry-redux'; type Props = { + uri: string, channelUri: ?string, claimsInChannel: ?Array, autoplay: boolean, @@ -13,7 +15,7 @@ type Props = { fetchClaims: (string, number) => void, }; -export default class RecommendedVideos extends React.PureComponent { +export default class RecommendedContent extends React.PureComponent { componentDidMount() { const { channelUri, fetchClaims, claimsInChannel } = this.props; if (channelUri && !claimsInChannel) { @@ -22,7 +24,27 @@ export default class RecommendedVideos extends React.PureComponent { } render() { - const { claimsInChannel, autoplay, setAutoplay } = this.props; + const { claimsInChannel, autoplay, uri, setAutoplay } = this.props; + + let recommendedContent; + if (claimsInChannel) { + recommendedContent = claimsInChannel.filter(claim => { + const { name, claim_id: claimId, channel_name: channelName, value } = claim; + const { isChannel } = parseURI(uri); + + // The uri may include the channel name + const recommendedUri = + isChannel && value && value.publisherSignature + ? buildURI({ + contentName: name, + claimName: channelName, + claimId: value.publisherSignature.certificateId, + }) + : buildURI({ claimName: name, claimId }); + + return recommendedUri !== uri; + }); + } return (
@@ -39,8 +61,8 @@ export default class RecommendedVideos extends React.PureComponent { /> - {claimsInChannel && - claimsInChannel.map(({ permanent_url: permanentUrl }) => ( + {recommendedContent && + recommendedContent.map(({ permanent_url: permanentUrl }) => ( {
- +
);