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

26 lines
1,009 B
JavaScript
Raw Normal View History

2021-03-11 12:08:11 -05:00
import { connect } from 'react-redux';
import { doFetchSubCount, selectSubCountForUri } from 'lbryinc';
2021-11-17 17:01:48 +08: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) => {
2021-11-17 17:01:48 +08:00
const claim = selectClaimForUri(state, props.uri);
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 && selectSubCountForUri(state, channelUri);
2021-06-17 14:55:23 -04:00
return {
isInsufficientCredits: selectInsufficientCreditsForUri(state, props.uri),
title: selectTitleForUri(state, props.uri),
channelClaimId,
subCount,
2021-06-17 14:55:23 -04:00
};
};
2021-03-11 12:08:11 -05:00
const perform = (dispatch) => ({
fetchSubCount: (claimId) => dispatch(doFetchSubCount(claimId)),
});
export default connect(select, perform)(FileTitleSection);