lbry-desktop/ui/component/fileRenderInitiator/index.js
2022-03-16 16:36:50 -04:00

46 lines
1.7 KiB
JavaScript

import { connect } from 'react-redux';
import { doUriInitiatePlay } from 'redux/actions/content';
import {
selectThumbnailForUri,
makeSelectClaimWasPurchased,
selectIsLivestreamClaimForUri,
} from 'redux/selectors/claims';
import { makeSelectFileInfoForUri } from 'redux/selectors/file_info';
import * as SETTINGS from 'constants/settings';
import { selectCostInfoForUri } from 'lbryinc';
import { selectUserVerifiedEmail } from 'redux/selectors/user';
import { selectClientSetting } from 'redux/selectors/settings';
import { withRouter } from 'react-router';
import {
makeSelectIsPlaying,
selectShouldObscurePreviewForUri,
selectInsufficientCreditsForUri,
makeSelectFileRenderModeForUri,
} from 'redux/selectors/content';
import FileRenderInitiator from './view';
import { selectIsActiveLivestreamForUri } from 'redux/selectors/livestream';
const select = (state, props) => {
const { uri } = props;
return {
claimThumbnail: selectThumbnailForUri(state, uri),
fileInfo: makeSelectFileInfoForUri(uri)(state),
obscurePreview: selectShouldObscurePreviewForUri(state, uri),
isPlaying: makeSelectIsPlaying(uri)(state),
insufficientCredits: selectInsufficientCreditsForUri(state, uri),
autoplay: selectClientSetting(state, SETTINGS.AUTOPLAY_MEDIA),
costInfo: selectCostInfoForUri(state, uri),
renderMode: makeSelectFileRenderModeForUri(uri)(state),
claimWasPurchased: makeSelectClaimWasPurchased(uri)(state),
authenticated: selectUserVerifiedEmail(state),
isCurrentClaimLive: selectIsActiveLivestreamForUri(state, uri),
isLivestreamClaim: selectIsLivestreamClaimForUri(state, uri),
};
};
const perform = {
doUriInitiatePlay,
};
export default withRouter(connect(select, perform)(FileRenderInitiator));