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

26 lines
1,009 B
JavaScript
Raw Normal View History

2021-03-11 18:08:11 +01:00
import { connect } from 'react-redux';
import { doFetchSubCount, selectSubCountForUri } from 'lbryinc';
2021-11-17 10:01:48 +01:00
import { selectTitleForUri, selectClaimForUri } from 'redux/selectors/claims';
import { selectInsufficientCreditsForUri } from 'redux/selectors/content';
2021-03-11 18:08:11 +01:00
import FileTitleSection from './view';
2021-06-17 20:55:23 +02:00
const select = (state, props) => {
2021-11-17 10:01:48 +01: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 20:55:23 +02:00
return {
isInsufficientCredits: selectInsufficientCreditsForUri(state, props.uri),
title: selectTitleForUri(state, props.uri),
channelClaimId,
subCount,
2021-06-17 20:55:23 +02:00
};
};
2021-03-11 18:08:11 +01:00
const perform = (dispatch) => ({
fetchSubCount: (claimId) => dispatch(doFetchSubCount(claimId)),
});
export default connect(select, perform)(FileTitleSection);