2021-03-11 12:08:11 -05:00
|
|
|
import { connect } from 'react-redux';
|
2021-12-31 12:52:26 -05:00
|
|
|
import { doFetchSubCount, selectSubCountForUri } from 'lbryinc';
|
2022-01-19 20:46:01 -05:00
|
|
|
import { selectTitleForUri, selectClaimForUri } from 'redux/selectors/claims';
|
|
|
|
import { selectInsufficientCreditsForUri } from 'redux/selectors/content';
|
2021-03-11 12:08:11 -05:00
|
|
|
import FileTitleSection from './view';
|
|
|
|
|
2021-06-17 14:55:23 -04:00
|
|
|
const select = (state, props) => {
|
2022-01-19 20:46:01 -05:00
|
|
|
const claim = selectClaimForUri(state, props.uri);
|
2021-08-19 12:25:45 -03: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;
|
2021-12-31 12:52:26 -05:00
|
|
|
const subCount = channelUri && selectSubCountForUri(state, channelUri);
|
2021-08-19 12:25:45 -03:00
|
|
|
|
2021-06-17 14:55:23 -04:00
|
|
|
return {
|
2022-01-19 20:46:01 -05:00
|
|
|
isInsufficientCredits: selectInsufficientCreditsForUri(state, props.uri),
|
|
|
|
title: selectTitleForUri(state, props.uri),
|
2021-08-19 12:25:45 -03:00
|
|
|
channelClaimId,
|
|
|
|
subCount,
|
2021-06-17 14:55:23 -04:00
|
|
|
};
|
|
|
|
};
|
2021-03-11 12:08:11 -05:00
|
|
|
|
2021-08-19 12:25:45 -03:00
|
|
|
const perform = (dispatch) => ({
|
|
|
|
fetchSubCount: (claimId) => dispatch(doFetchSubCount(claimId)),
|
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(select, perform)(FileTitleSection);
|