2018-07-24 20:50:04 -04:00
|
|
|
import { connect } from 'react-redux';
|
2021-09-16 17:00:44 -03:00
|
|
|
import { makeSelectClaimForUri } from 'lbry-redux';
|
2021-03-19 23:04:12 +08:00
|
|
|
import { doFetchRecommendedContent } from 'redux/actions/search';
|
2020-07-27 16:04:12 -04:00
|
|
|
import { makeSelectRecommendedContentForUri, selectIsSearching } from 'redux/selectors/search';
|
2020-06-15 16:33:03 -04:00
|
|
|
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
2021-07-06 09:29:46 +08:00
|
|
|
import RecommendedContent from './view';
|
2018-07-24 20:50:04 -04:00
|
|
|
|
2021-09-02 18:39:40 -04:00
|
|
|
const select = (state, props) => {
|
|
|
|
const claim = makeSelectClaimForUri(props.uri)(state);
|
|
|
|
const { claim_id: claimId } = claim;
|
2021-09-16 17:00:44 -03:00
|
|
|
const recommendedContentUris = makeSelectRecommendedContentForUri(props.uri)(state);
|
|
|
|
const nextRecommendedUri = recommendedContentUris && recommendedContentUris[0];
|
|
|
|
|
2021-09-02 18:39:40 -04:00
|
|
|
return {
|
|
|
|
claim,
|
|
|
|
claimId,
|
2021-09-16 17:00:44 -03:00
|
|
|
recommendedContentUris,
|
|
|
|
nextRecommendedUri,
|
|
|
|
isSearching: selectIsSearching(state),
|
|
|
|
isAuthenticated: selectUserVerifiedEmail(state),
|
2021-09-02 18:39:40 -04:00
|
|
|
};
|
|
|
|
};
|
2018-07-24 20:50:04 -04:00
|
|
|
|
2021-09-16 17:00:44 -03:00
|
|
|
export default connect(select, { doFetchRecommendedContent })(RecommendedContent);
|