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

47 lines
1.6 KiB
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
import {
makeSelectFileInfoForUri,
makeSelectTitleForUri,
makeSelectStreamingUrlForUri,
makeSelectClaimIsNsfw,
SETTINGS,
} from 'lbry-redux';
2020-01-06 15:57:49 -05:00
import {
2020-04-13 19:48:11 -04:00
makeSelectIsPlayerFloating,
selectPrimaryUri,
2020-01-06 15:57:49 -05:00
selectPlayingUri,
makeSelectFileRenderModeForUri,
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 { doFetchRecommendedContent } from 'redux/actions/search';
2019-08-13 01:35:13 -04:00
import { withRouter } from 'react-router';
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 playingUri = selectPlayingUri(state);
const primaryUri = selectPrimaryUri(state);
const uri = playingUri && playingUri.uri;
2019-08-13 01:35:13 -04:00
return {
uri,
primaryUri,
playingUri,
2019-08-13 01:35:13 -04:00
title: makeSelectTitleForUri(uri)(state),
fileInfo: makeSelectFileInfoForUri(uri)(state),
mature: makeSelectClaimIsNsfw(props.uri)(state),
2020-04-13 19:48:11 -04:00
isFloating: makeSelectIsPlayerFloating(props.location)(state),
2020-05-21 11:38:28 -04:00
streamingUrl: makeSelectStreamingUrlForUri(uri)(state),
2019-08-13 01:35:13 -04:00
floatingPlayerEnabled: makeSelectClientSetting(SETTINGS.FLOATING_PLAYER)(state),
renderMode: makeSelectFileRenderModeForUri(uri)(state),
2021-01-08 10:21:27 -05:00
videoTheaterMode: makeSelectClientSetting(SETTINGS.VIDEO_THEATER_MODE)(state),
2019-08-13 01:35:13 -04:00
};
};
2017-04-23 16:56:50 +07:00
const perform = (dispatch) => ({
closeFloatingPlayer: () => dispatch(doSetPlayingUri({ uri: null })),
doFetchRecommendedContent: (uri, mature) => dispatch(doFetchRecommendedContent(uri, mature)),
2017-06-05 21:21:55 -07:00
});
2017-04-23 16:56:50 +07:00
export default withRouter(connect(select, perform)(FileRenderFloating));