add message for 0 returned results in related content #1908

Merged
neb-b merged 1 commit from related-fix into master 2018-08-28 00:58:23 +02:00
3 changed files with 13 additions and 11 deletions

View file

@ -1,10 +1,16 @@
import { connect } from 'react-redux';
import { makeSelectClaimForUri, doSearch, makeSelectRecommendedContentForUri } from 'lbry-redux';
import {
makeSelectClaimForUri,
doSearch,
makeSelectRecommendedContentForUri,
selectIsSearching,
} from 'lbry-redux';
import RecommendedVideos from './view';
const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
recommendedContent: makeSelectRecommendedContentForUri(props.uri)(state),
isSearching: selectIsSearching(state),
});
const perform = dispatch => ({

View file

@ -7,6 +7,7 @@ type Props = {
uri: string,
claim: ?Claim,
recommendedContent: Array<string>,
isSearching: boolean,
search: string => void,
};
@ -46,13 +47,12 @@ export default class RecommendedContent extends React.PureComponent<Props> {
didSearch: ?boolean;
render() {
const { recommendedContent } = this.props;
const { recommendedContent, isSearching } = this.props;
return (
<section className="card__list--recommended">
<span>Related</span>
{recommendedContent &&
recommendedContent.length &&
recommendedContent.map(recommendedUri => (
<FileTile
size="small"
@ -62,6 +62,9 @@ export default class RecommendedContent extends React.PureComponent<Props> {
uri={recommendedUri}
/>
))}
{recommendedContent &&
!recommendedContent.length &&
!isSearching && <div className="card__subtitle">No related content found</div>}
</section>
);
}

View file

@ -160,13 +160,6 @@ class FilePage extends React.Component<Props> {
editUri = buildURI(uriObject);
}
let recommendedUri = uri;
if (!recommendedUri.includes('#')) {
// at a vanity url
// append the claim ID so we can properly strip it out of reccomended videos
recommendedUri = `${recommendedUri}#${claim.claim_id}`;
}
return (
neb-b commented 2018-08-27 05:20:50 +02:00 (Migrated from github.com)
Review
This isn't needed after https://github.com/lbryio/lbry-redux/pull/72
<Page forContent>
<section className="content__wrapper">
@ -251,7 +244,7 @@ class FilePage extends React.Component<Props> {
</div>
</div>
</section>
<RecommendedContent uri={recommendedUri} />
<RecommendedContent uri={uri} />
</Page>
);
}