049b1c727e
* Exclude default homepage data at compile time The youtuber IDs alone is pretty huge, and is unused in the `CUSTOM_HOMEPAGE=true` configuration. * Remove Desktop items and other cleanup - Moved constants out of the component. - Remove SIMPLE_SITE check. - Remove Desktop-only items * Sidebar: limit subscription and tag section Too slow for huge lists Limit to 10 initially, and load everything on "Show more" * Fix makeSelectThumbnailForUri - Fix memo - Expose function to extract directly from claim if client already have it.
47 lines
2.1 KiB
JavaScript
47 lines
2.1 KiB
JavaScript
import { connect } from 'react-redux';
|
|
import { doPlayUri, doSetPlayingUri, doSetPrimaryUri } from 'redux/actions/content';
|
|
import { selectThumbnailForUri, makeSelectClaimForUri, makeSelectClaimWasPurchased } from 'redux/selectors/claims';
|
|
import { makeSelectFileInfoForUri } from 'redux/selectors/file_info';
|
|
import * as SETTINGS from 'constants/settings';
|
|
import * as COLLECTIONS_CONSTS from 'constants/collections';
|
|
import { makeSelectCostInfoForUri } from 'lbryinc';
|
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
|
import { withRouter } from 'react-router';
|
|
import {
|
|
makeSelectIsPlaying,
|
|
makeSelectShouldObscurePreview,
|
|
makeSelectInsufficientCreditsForUri,
|
|
makeSelectFileRenderModeForUri,
|
|
} from 'redux/selectors/content';
|
|
import FileRenderInitiator from './view';
|
|
import { doAnaltyicsPurchaseEvent } from 'redux/actions/app';
|
|
|
|
const select = (state, props) => {
|
|
const { search } = props.location;
|
|
const urlParams = new URLSearchParams(search);
|
|
const collectionId = urlParams.get(COLLECTIONS_CONSTS.COLLECTION_ID);
|
|
|
|
return {
|
|
claimThumbnail: selectThumbnailForUri(state, props.uri),
|
|
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
|
obscurePreview: makeSelectShouldObscurePreview(props.uri)(state),
|
|
isPlaying: makeSelectIsPlaying(props.uri)(state),
|
|
insufficientCredits: makeSelectInsufficientCreditsForUri(props.uri)(state),
|
|
autoplay: makeSelectClientSetting(SETTINGS.AUTOPLAY_MEDIA)(state),
|
|
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
|
renderMode: makeSelectFileRenderModeForUri(props.uri)(state),
|
|
claim: makeSelectClaimForUri(props.uri)(state),
|
|
claimWasPurchased: makeSelectClaimWasPurchased(props.uri)(state),
|
|
collectionId,
|
|
};
|
|
};
|
|
|
|
const perform = (dispatch) => ({
|
|
play: (uri, collectionId, isPlayable) => {
|
|
dispatch(doSetPrimaryUri(uri));
|
|
if (isPlayable) dispatch(doSetPlayingUri({ uri, collectionId }));
|
|
dispatch(doPlayUri(uri, undefined, undefined, (fileInfo) => dispatch(doAnaltyicsPurchaseEvent(fileInfo))));
|
|
},
|
|
});
|
|
|
|
export default withRouter(connect(select, perform)(FileRenderInitiator));
|