2018-07-25 02:50:04 +02:00
|
|
|
import { connect } from 'react-redux';
|
2021-12-06 19:01:40 +01:00
|
|
|
import { makeSelectClaimForUri, makeSelectMetadataForUri } from 'redux/selectors/claims';
|
2021-03-19 16:04:12 +01:00
|
|
|
import { doFetchRecommendedContent } from 'redux/actions/search';
|
2021-11-16 02:10:03 +01:00
|
|
|
import { selectRecommendedContentForUri, selectIsSearching } from 'redux/selectors/search';
|
2020-06-15 22:33:03 +02:00
|
|
|
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
2021-07-06 03:29:46 +02:00
|
|
|
import RecommendedContent from './view';
|
2018-07-25 02:50:04 +02:00
|
|
|
|
2021-09-03 00:39:40 +02:00
|
|
|
const select = (state, props) => {
|
|
|
|
const claim = makeSelectClaimForUri(props.uri)(state);
|
|
|
|
const { claim_id: claimId } = claim;
|
2021-11-16 02:10:03 +01:00
|
|
|
const recommendedContentUris = selectRecommendedContentForUri(state, props.uri);
|
2021-09-16 22:00:44 +02:00
|
|
|
const nextRecommendedUri = recommendedContentUris && recommendedContentUris[0];
|
2021-12-06 19:01:40 +01:00
|
|
|
const metadata = makeSelectMetadataForUri(props.uri)(state);
|
2021-09-16 22:00:44 +02:00
|
|
|
|
2021-09-03 00:39:40 +02:00
|
|
|
return {
|
|
|
|
claim,
|
|
|
|
claimId,
|
2021-09-16 22:00:44 +02:00
|
|
|
recommendedContentUris,
|
|
|
|
nextRecommendedUri,
|
|
|
|
isSearching: selectIsSearching(state),
|
|
|
|
isAuthenticated: selectUserVerifiedEmail(state),
|
2021-12-06 19:01:40 +01:00
|
|
|
metadata,
|
2021-09-03 00:39:40 +02:00
|
|
|
};
|
|
|
|
};
|
2018-07-25 02:50:04 +02:00
|
|
|
|
2021-09-16 22:00:44 +02:00
|
|
|
export default connect(select, { doFetchRecommendedContent })(RecommendedContent);
|