add message for 0 returned results in related content #1908
3 changed files with 13 additions and 11 deletions
|
@ -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 => ({
|
||||
|
|
|
@ -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>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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 (
|
||||
|
||||
<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>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue
This isn't needed after https://github.com/lbryio/lbry-redux/pull/72