lbry-desktop/ui/component/recommendedContent/index.js

27 lines
1.3 KiB
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
2021-04-08 17:21:45 +02:00
import { makeSelectClaimIsNsfw, makeSelectClaimForUri } from 'lbry-redux';
import { doRecommendationUpdate, doRecommendationClicked } from 'redux/actions/content';
import { doFetchRecommendedContent } from 'redux/actions/search';
2020-07-27 22:04:12 +02:00
import { makeSelectRecommendedContentForUri, selectIsSearching } from 'redux/selectors/search';
import { selectUserVerifiedEmail } from 'redux/selectors/user';
import { makeSelectNextUnplayedRecommended } from 'redux/selectors/content';
import RecommendedContent from './view';
const select = (state, props) => ({
2020-01-28 23:05:44 +01:00
mature: makeSelectClaimIsNsfw(props.uri)(state),
2018-08-03 20:28:11 +02:00
recommendedContent: makeSelectRecommendedContentForUri(props.uri)(state),
nextRecommendedUri: makeSelectNextUnplayedRecommended(props.uri)(state),
isSearching: selectIsSearching(state),
2020-03-26 22:47:07 +01:00
isAuthenticated: selectUserVerifiedEmail(state),
2021-04-08 17:21:45 +02:00
claim: makeSelectClaimForUri(props.uri)(state),
});
const perform = (dispatch) => ({
doFetchRecommendedContent: (uri, mature) => dispatch(doFetchRecommendedContent(uri, mature)),
doRecommendationUpdate: (claimId, urls, id, parentId) =>
dispatch(doRecommendationUpdate(claimId, urls, id, parentId)),
doRecommendationClicked: (claimId, index) => dispatch(doRecommendationClicked(claimId, index)),
});
export default connect(select, perform)(RecommendedContent);