2021-03-11 18:08:11 +01:00
|
|
|
import { connect } from 'react-redux';
|
2021-08-19 17:25:45 +02:00
|
|
|
import { doFetchSubCount, makeSelectSubCountForUri } from 'lbryinc';
|
2021-10-08 05:47:39 +02:00
|
|
|
import { makeSelectTitleForUri, makeSelectClaimForUri } from 'redux/selectors/claims';
|
2021-03-11 18:08:11 +01:00
|
|
|
import { makeSelectInsufficientCreditsForUri } from 'redux/selectors/content';
|
|
|
|
import FileTitleSection from './view';
|
|
|
|
|
2021-06-17 20:55:23 +02:00
|
|
|
const select = (state, props) => {
|
|
|
|
const claim = makeSelectClaimForUri(props.uri)(state);
|
2021-08-19 17:25:45 +02:00
|
|
|
const channelClaimId = claim && claim.signing_channel ? claim.signing_channel.claim_id : undefined;
|
|
|
|
const channelUri = claim && claim.signing_channel ? claim.signing_channel.canonical_url : undefined;
|
|
|
|
const subCount = channelUri && makeSelectSubCountForUri(channelUri)(state);
|
|
|
|
|
2021-06-17 20:55:23 +02:00
|
|
|
return {
|
|
|
|
isInsufficientCredits: makeSelectInsufficientCreditsForUri(props.uri)(state),
|
|
|
|
title: makeSelectTitleForUri(props.uri)(state),
|
2021-08-19 17:25:45 +02:00
|
|
|
channelClaimId,
|
|
|
|
subCount,
|
2021-06-17 20:55:23 +02:00
|
|
|
};
|
|
|
|
};
|
2021-03-11 18:08:11 +01:00
|
|
|
|
2021-08-19 17:25:45 +02:00
|
|
|
const perform = (dispatch) => ({
|
|
|
|
fetchSubCount: (claimId) => dispatch(doFetchSubCount(claimId)),
|
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(select, perform)(FileTitleSection);
|