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

37 lines
1.4 KiB
JavaScript
Raw Normal View History

2019-08-13 01:35:13 -04:00
import * as SETTINGS from 'constants/settings';
import { connect } from 'react-redux';
import { makeSelectFileInfoForUri, makeSelectTitleForUri } from 'lbry-redux';
import { doClaimEligiblePurchaseRewards } from 'lbryinc';
2020-01-06 15:57:49 -05:00
import {
makeSelectIsPlaying,
selectPlayingUri,
makeSelectFileRenderModeForUri,
makeSelectStreamingUrlForUriWebProxy,
2020-01-06 15:57:49 -05:00
} from 'redux/selectors/content';
2019-08-13 01:35:13 -04:00
import { makeSelectClientSetting } from 'redux/selectors/settings';
import { doSetPlayingUri } from 'redux/actions/content';
import { withRouter } from 'react-router';
2019-08-13 23:04:08 -04:00
import { doAnalyticsView } from 'redux/actions/app';
import FileRenderFloating from './view';
2017-05-14 23:50:59 -04:00
2019-08-13 01:35:13 -04:00
const select = (state, props) => {
const uri = selectPlayingUri(state);
return {
uri,
title: makeSelectTitleForUri(uri)(state),
fileInfo: makeSelectFileInfoForUri(uri)(state),
isPlaying: makeSelectIsPlaying(uri)(state),
streamingUrl: makeSelectStreamingUrlForUriWebProxy(uri)(state),
2019-08-13 01:35:13 -04:00
floatingPlayerEnabled: makeSelectClientSetting(SETTINGS.FLOATING_PLAYER)(state),
renderMode: makeSelectFileRenderModeForUri(uri)(state),
2019-08-13 01:35:13 -04:00
};
};
2017-04-23 16:56:50 +07:00
2017-06-05 21:21:55 -07:00
const perform = dispatch => ({
2019-08-13 01:35:13 -04:00
clearPlayingUri: () => dispatch(doSetPlayingUri(null)),
2019-08-13 23:04:08 -04:00
triggerAnalyticsView: (uri, timeToStart) => dispatch(doAnalyticsView(uri, timeToStart)),
claimRewards: () => dispatch(doClaimEligiblePurchaseRewards()),
2017-06-05 21:21:55 -07:00
});
2017-04-23 16:56:50 +07:00
export default withRouter(connect(select, perform)(FileRenderFloating));