2020-04-01 20:43:50 +02:00
|
|
|
import { connect } from 'react-redux';
|
2021-10-08 05:47:39 +02:00
|
|
|
import { makeSelectFileInfoForUri, makeSelectStreamingUrlForUri } from 'redux/selectors/file_info';
|
|
|
|
import { makeSelectClaimWasPurchased } from 'redux/selectors/claims';
|
2020-06-15 22:33:03 +02:00
|
|
|
import { doClaimEligiblePurchaseRewards } from 'redux/actions/rewards';
|
2021-04-02 10:53:28 +02:00
|
|
|
import { makeSelectFileRenderModeForUri, selectPrimaryUri } from 'redux/selectors/content';
|
2020-04-01 20:43:50 +02:00
|
|
|
import { withRouter } from 'react-router';
|
|
|
|
import { doAnalyticsView } from 'redux/actions/app';
|
|
|
|
import FileRenderInline from './view';
|
2022-01-20 02:46:01 +01:00
|
|
|
import { selectCostInfoForUri } from 'lbryinc';
|
2020-04-01 20:43:50 +02:00
|
|
|
|
|
|
|
const select = (state, props) => ({
|
|
|
|
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
2021-04-02 10:53:28 +02:00
|
|
|
isPlaying: selectPrimaryUri(state) === props.uri,
|
2020-05-21 17:38:28 +02:00
|
|
|
streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state),
|
2020-04-01 20:43:50 +02:00
|
|
|
renderMode: makeSelectFileRenderModeForUri(props.uri)(state),
|
2022-01-20 02:46:01 +01:00
|
|
|
costInfo: selectCostInfoForUri(state, props.uri),
|
2021-05-24 10:52:30 +02:00
|
|
|
claimWasPurchased: makeSelectClaimWasPurchased(props.uri)(state),
|
2020-04-01 20:43:50 +02:00
|
|
|
});
|
|
|
|
|
2021-02-25 07:23:23 +01:00
|
|
|
const perform = (dispatch) => ({
|
2020-04-01 20:43:50 +02:00
|
|
|
triggerAnalyticsView: (uri, timeToStart) => dispatch(doAnalyticsView(uri, timeToStart)),
|
|
|
|
claimRewards: () => dispatch(doClaimEligiblePurchaseRewards()),
|
|
|
|
});
|
|
|
|
|
|
|
|
export default withRouter(connect(select, perform)(FileRenderInline));
|