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

34 lines
1.2 KiB
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
import { makeSelectFileInfoForUri, makeSelectTitleForUri, makeSelectStreamingUrlForUri, SETTINGS } from 'lbry-redux';
2020-01-06 21:57:49 +01:00
import {
2020-04-14 01:48:11 +02:00
makeSelectIsPlayerFloating,
selectFloatingUri,
2020-01-06 21:57:49 +01:00
selectPlayingUri,
makeSelectFileRenderModeForUri,
2020-01-06 21:57:49 +01:00
} from 'redux/selectors/content';
2019-08-13 07:35:13 +02:00
import { makeSelectClientSetting } from 'redux/selectors/settings';
2020-07-22 22:56:58 +02:00
import { doCloseFloatingPlayer } from 'redux/actions/content';
2019-08-13 07:35:13 +02:00
import { withRouter } from 'react-router';
import FileRenderFloating from './view';
2017-05-15 05:50:59 +02:00
2019-08-13 07:35:13 +02:00
const select = (state, props) => {
const floatingUri = selectFloatingUri(state);
const playingUri = selectPlayingUri(state);
const uri = floatingUri || playingUri;
2019-08-13 07:35:13 +02:00
return {
uri,
title: makeSelectTitleForUri(uri)(state),
fileInfo: makeSelectFileInfoForUri(uri)(state),
2020-04-14 01:48:11 +02:00
isFloating: makeSelectIsPlayerFloating(props.location)(state),
2020-05-21 17:38:28 +02:00
streamingUrl: makeSelectStreamingUrlForUri(uri)(state),
2019-08-13 07:35:13 +02:00
floatingPlayerEnabled: makeSelectClientSetting(SETTINGS.FLOATING_PLAYER)(state),
renderMode: makeSelectFileRenderModeForUri(uri)(state),
2019-08-13 07:35:13 +02:00
};
};
2017-04-23 11:56:50 +02:00
2017-06-06 06:21:55 +02:00
const perform = dispatch => ({
closeFloatingPlayer: () => dispatch(doCloseFloatingPlayer(null)),
2017-06-06 06:21:55 +02:00
});
2017-04-23 11:56:50 +02:00
export default withRouter(connect(select, perform)(FileRenderFloating));