9e13596104
- FileRenderInitiator: we don't display if it's not Audio or Video ("playables"). But only do that if it's free or was purchased, otherwise there's no button to buy it. - FileRenderInline: if the user have not purchased it, don't show anything (not even the spinner).
24 lines
1.1 KiB
JavaScript
24 lines
1.1 KiB
JavaScript
import { connect } from 'react-redux';
|
|
import { makeSelectFileInfoForUri, makeSelectStreamingUrlForUri, makeSelectClaimWasPurchased } from 'lbry-redux';
|
|
import { doClaimEligiblePurchaseRewards } from 'redux/actions/rewards';
|
|
import { makeSelectFileRenderModeForUri, selectPrimaryUri } from 'redux/selectors/content';
|
|
import { withRouter } from 'react-router';
|
|
import { doAnalyticsView } from 'redux/actions/app';
|
|
import FileRenderInline from './view';
|
|
import { makeSelectCostInfoForUri } from 'lbryinc';
|
|
|
|
const select = (state, props) => ({
|
|
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
|
isPlaying: selectPrimaryUri(state) === props.uri,
|
|
streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state),
|
|
renderMode: makeSelectFileRenderModeForUri(props.uri)(state),
|
|
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
|
claimWasPurchased: makeSelectClaimWasPurchased(props.uri)(state),
|
|
});
|
|
|
|
const perform = (dispatch) => ({
|
|
triggerAnalyticsView: (uri, timeToStart) => dispatch(doAnalyticsView(uri, timeToStart)),
|
|
claimRewards: () => dispatch(doClaimEligiblePurchaseRewards()),
|
|
});
|
|
|
|
export default withRouter(connect(select, perform)(FileRenderInline));
|