2019-08-13 07:35:13 +02:00
|
|
|
import { connect } from 'react-redux';
|
2022-02-23 22:13:22 +01:00
|
|
|
import { doUriInitiatePlay, doSetPlayingUri, doSetPrimaryUri } from 'redux/actions/content';
|
|
|
|
import { selectThumbnailForUri, makeSelectClaimWasPurchased } from 'redux/selectors/claims';
|
2021-10-17 10:36:14 +02:00
|
|
|
import { makeSelectFileInfoForUri } from 'redux/selectors/file_info';
|
|
|
|
import * as SETTINGS from 'constants/settings';
|
2021-11-19 03:40:01 +01:00
|
|
|
import { selectCostInfoForUri } from 'lbryinc';
|
2020-06-15 22:33:03 +02:00
|
|
|
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
2021-11-23 05:29:04 +01:00
|
|
|
import { selectClientSetting } from 'redux/selectors/settings';
|
2020-04-01 20:43:50 +02:00
|
|
|
import { withRouter } from 'react-router';
|
2019-12-10 20:45:41 +01:00
|
|
|
import {
|
|
|
|
makeSelectIsPlaying,
|
2021-11-16 02:10:03 +01:00
|
|
|
selectShouldObscurePreviewForUri,
|
2021-11-19 03:40:01 +01:00
|
|
|
selectInsufficientCreditsForUri,
|
2020-04-01 20:43:50 +02:00
|
|
|
makeSelectFileRenderModeForUri,
|
2019-12-10 20:45:41 +01:00
|
|
|
} from 'redux/selectors/content';
|
2020-04-01 20:43:50 +02:00
|
|
|
import FileRenderInitiator from './view';
|
2022-02-23 22:13:22 +01:00
|
|
|
import { selectIsActiveLivestreamForUri } from 'redux/selectors/livestream';
|
2019-08-13 07:35:13 +02:00
|
|
|
|
2021-09-02 22:05:32 +02:00
|
|
|
const select = (state, props) => {
|
2022-02-01 21:29:00 +01:00
|
|
|
const { uri } = props;
|
2021-09-02 22:05:32 +02:00
|
|
|
|
|
|
|
return {
|
2022-02-01 21:29:00 +01:00
|
|
|
claimThumbnail: selectThumbnailForUri(state, uri),
|
|
|
|
fileInfo: makeSelectFileInfoForUri(uri)(state),
|
|
|
|
obscurePreview: selectShouldObscurePreviewForUri(state, uri),
|
|
|
|
isPlaying: makeSelectIsPlaying(uri)(state),
|
|
|
|
insufficientCredits: selectInsufficientCreditsForUri(state, uri),
|
2021-11-23 05:29:04 +01:00
|
|
|
autoplay: selectClientSetting(state, SETTINGS.AUTOPLAY_MEDIA),
|
2022-02-01 21:29:00 +01:00
|
|
|
costInfo: selectCostInfoForUri(state, uri),
|
|
|
|
renderMode: makeSelectFileRenderModeForUri(uri)(state),
|
|
|
|
claimWasPurchased: makeSelectClaimWasPurchased(uri)(state),
|
2021-09-02 22:05:32 +02:00
|
|
|
authenticated: selectUserVerifiedEmail(state),
|
2022-02-23 22:13:22 +01:00
|
|
|
isCurrentClaimLive: selectIsActiveLivestreamForUri(state, uri),
|
2021-09-02 22:05:32 +02:00
|
|
|
};
|
|
|
|
};
|
2019-08-13 07:35:13 +02:00
|
|
|
|
2022-02-01 21:29:00 +01:00
|
|
|
const perform = {
|
|
|
|
doUriInitiatePlay,
|
2022-02-01 21:30:57 +01:00
|
|
|
doSetPlayingUri,
|
2022-02-23 22:13:22 +01:00
|
|
|
doSetPrimaryUri,
|
2022-02-01 21:29:00 +01:00
|
|
|
};
|
2019-08-13 07:35:13 +02:00
|
|
|
|
2020-04-01 20:43:50 +02:00
|
|
|
export default withRouter(connect(select, perform)(FileRenderInitiator));
|