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

63 lines
2.5 KiB
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
import { selectTitleForUri, makeSelectClaimWasPurchased, selectClaimForUri } from 'redux/selectors/claims';
import { makeSelectStreamingUrlForUri } from 'redux/selectors/file_info';
import {
makeSelectNextUrlForCollectionAndUrl,
makeSelectPreviousUrlForCollectionAndUrl,
} from 'redux/selectors/collections';
import * as SETTINGS from 'constants/settings';
2020-01-06 21:57:49 +01:00
import {
2020-04-14 01:48:11 +02:00
makeSelectIsPlayerFloating,
selectPrimaryUri,
2020-01-06 21:57:49 +01:00
selectPlayingUri,
makeSelectFileRenderModeForUri,
2020-01-06 21:57:49 +01:00
} from 'redux/selectors/content';
import { selectClientSetting } from 'redux/selectors/settings';
import { selectCostInfoForUri } from 'lbryinc';
import { doUriInitiatePlay, doSetPlayingUri } from 'redux/actions/content';
import { doFetchRecommendedContent } from 'redux/actions/search';
2019-08-13 07:35:13 +02:00
import { withRouter } from 'react-router';
import { getChannelIdFromClaim } from 'util/claim';
import { selectMobilePlayerDimensions } from 'redux/selectors/app';
import { selectIsActiveLivestreamForUri } from 'redux/selectors/livestream';
import { doSetMobilePlayerDimensions } from 'redux/actions/app';
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 { location } = props;
const playingUri = selectPlayingUri(state);
const { uri, collectionId } = playingUri || {};
const claim = selectClaimForUri(state, uri);
2019-08-13 07:35:13 +02:00
return {
uri,
playingUri,
primaryUri: selectPrimaryUri(state),
title: selectTitleForUri(state, uri),
isFloating: makeSelectIsPlayerFloating(location)(state),
2020-05-21 17:38:28 +02:00
streamingUrl: makeSelectStreamingUrlForUri(uri)(state),
floatingPlayerEnabled: selectClientSetting(state, SETTINGS.FLOATING_PLAYER),
renderMode: makeSelectFileRenderModeForUri(uri)(state),
videoTheaterMode: selectClientSetting(state, SETTINGS.VIDEO_THEATER_MODE),
costInfo: selectCostInfoForUri(state, uri),
claimWasPurchased: makeSelectClaimWasPurchased(uri)(state),
nextListUri: collectionId && makeSelectNextUrlForCollectionAndUrl(collectionId, uri)(state),
previousListUri: collectionId && makeSelectPreviousUrlForCollectionAndUrl(collectionId, uri)(state),
collectionId,
isCurrentClaimLive: selectIsActiveLivestreamForUri(state, uri),
channelClaimId: claim && getChannelIdFromClaim(claim),
mobilePlayerDimensions: selectMobilePlayerDimensions(state),
2019-08-13 07:35:13 +02:00
};
};
2017-04-23 11:56:50 +02:00
const perform = {
doFetchRecommendedContent,
doUriInitiatePlay,
doSetPlayingUri,
doSetMobilePlayerDimensions,
};
2017-04-23 11:56:50 +02:00
export default withRouter(connect(select, perform)(FileRenderFloating));