2019-08-13 07:35:13 +02:00
|
|
|
import * as SETTINGS from 'constants/settings';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { doPlayUri, doSetPlayingUri } from 'redux/actions/content';
|
2020-04-01 20:43:50 +02:00
|
|
|
import { makeSelectFileInfoForUri, makeSelectThumbnailForUri, makeSelectClaimForUri } from 'lbry-redux';
|
2019-08-19 20:15:54 +02:00
|
|
|
import { makeSelectCostInfoForUri } from 'lbryinc';
|
2019-08-13 07:35:13 +02:00
|
|
|
import { makeSelectClientSetting } 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,
|
|
|
|
makeSelectShouldObscurePreview,
|
|
|
|
selectPlayingUri,
|
2020-04-01 20:43:50 +02:00
|
|
|
makeSelectInsufficientCreditsForUri,
|
|
|
|
makeSelectStreamingUrlForUriWebProxy,
|
|
|
|
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';
|
2019-08-13 07:35:13 +02:00
|
|
|
|
|
|
|
const select = (state, props) => ({
|
|
|
|
thumbnail: makeSelectThumbnailForUri(props.uri)(state),
|
|
|
|
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
|
|
|
obscurePreview: makeSelectShouldObscurePreview(props.uri)(state),
|
|
|
|
isPlaying: makeSelectIsPlaying(props.uri)(state),
|
|
|
|
playingUri: selectPlayingUri(state),
|
2020-04-01 20:43:50 +02:00
|
|
|
insufficientCredits: makeSelectInsufficientCreditsForUri(props.uri)(state),
|
|
|
|
streamingUrl: makeSelectStreamingUrlForUriWebProxy(props.uri)(state),
|
2019-08-13 07:35:13 +02:00
|
|
|
autoplay: makeSelectClientSetting(SETTINGS.AUTOPLAY)(state),
|
2019-08-19 20:15:54 +02:00
|
|
|
hasCostInfo: Boolean(makeSelectCostInfoForUri(props.uri)(state)),
|
2019-08-29 01:33:38 +02:00
|
|
|
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
2020-04-01 20:43:50 +02:00
|
|
|
renderMode: makeSelectFileRenderModeForUri(props.uri)(state),
|
2020-01-13 19:33:07 +01:00
|
|
|
claim: makeSelectClaimForUri(props.uri)(state),
|
2019-08-13 07:35:13 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
const perform = dispatch => ({
|
|
|
|
play: uri => {
|
|
|
|
dispatch(doSetPlayingUri(uri));
|
2019-08-13 22:54:57 +02:00
|
|
|
// @if TARGET='app'
|
2019-08-13 07:35:13 +02:00
|
|
|
dispatch(doPlayUri(uri));
|
2019-08-13 22:54:57 +02:00
|
|
|
// @endif
|
2019-08-13 07:35:13 +02:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2020-04-01 20:43:50 +02:00
|
|
|
export default withRouter(connect(select, perform)(FileRenderInitiator));
|