Merge pull request #1908 from lbryio/related-fix
add message for 0 returned results in related content
This commit is contained in:
commit
9de8451e21
3 changed files with 13 additions and 11 deletions
|
@ -1,10 +1,16 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { makeSelectClaimForUri, doSearch, makeSelectRecommendedContentForUri } from 'lbry-redux';
|
import {
|
||||||
|
makeSelectClaimForUri,
|
||||||
|
doSearch,
|
||||||
|
makeSelectRecommendedContentForUri,
|
||||||
|
selectIsSearching,
|
||||||
|
} from 'lbry-redux';
|
||||||
import RecommendedVideos from './view';
|
import RecommendedVideos from './view';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
claim: makeSelectClaimForUri(props.uri)(state),
|
claim: makeSelectClaimForUri(props.uri)(state),
|
||||||
recommendedContent: makeSelectRecommendedContentForUri(props.uri)(state),
|
recommendedContent: makeSelectRecommendedContentForUri(props.uri)(state),
|
||||||
|
isSearching: selectIsSearching(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
|
|
|
@ -7,6 +7,7 @@ type Props = {
|
||||||
uri: string,
|
uri: string,
|
||||||
claim: ?Claim,
|
claim: ?Claim,
|
||||||
recommendedContent: Array<string>,
|
recommendedContent: Array<string>,
|
||||||
|
isSearching: boolean,
|
||||||
search: string => void,
|
search: string => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -46,13 +47,12 @@ export default class RecommendedContent extends React.PureComponent<Props> {
|
||||||
didSearch: ?boolean;
|
didSearch: ?boolean;
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { recommendedContent } = this.props;
|
const { recommendedContent, isSearching } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="card__list--recommended">
|
<section className="card__list--recommended">
|
||||||
<span>Related</span>
|
<span>Related</span>
|
||||||
{recommendedContent &&
|
{recommendedContent &&
|
||||||
recommendedContent.length &&
|
|
||||||
recommendedContent.map(recommendedUri => (
|
recommendedContent.map(recommendedUri => (
|
||||||
<FileTile
|
<FileTile
|
||||||
size="small"
|
size="small"
|
||||||
|
@ -62,6 +62,9 @@ export default class RecommendedContent extends React.PureComponent<Props> {
|
||||||
uri={recommendedUri}
|
uri={recommendedUri}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
{recommendedContent &&
|
||||||
|
!recommendedContent.length &&
|
||||||
|
!isSearching && <div className="card__subtitle">No related content found</div>}
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,13 +160,6 @@ class FilePage extends React.Component<Props> {
|
||||||
editUri = buildURI(uriObject);
|
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 (
|
return (
|
||||||
<Page forContent>
|
<Page forContent>
|
||||||
<section className="content__wrapper">
|
<section className="content__wrapper">
|
||||||
|
@ -251,7 +244,7 @@ class FilePage extends React.Component<Props> {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<RecommendedContent uri={recommendedUri} />
|
<RecommendedContent uri={uri} />
|
||||||
</Page>
|
</Page>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue