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.
45 lines
1.8 KiB
JavaScript
45 lines
1.8 KiB
JavaScript
import { connect } from 'react-redux';
|
|
import {
|
|
makeSelectClaimForUri,
|
|
makeSelectIsUriResolving,
|
|
getThumbnailFromClaim,
|
|
makeSelectTitleForUri,
|
|
makeSelectChannelForClaimUri,
|
|
makeSelectClaimIsNsfw,
|
|
selectDateForUri,
|
|
} from 'redux/selectors/claims';
|
|
import { doFileGet } from 'redux/actions/file';
|
|
import { doResolveUri } from 'redux/actions/claims';
|
|
import { selectMutedChannels } from 'redux/selectors/blocked';
|
|
import { selectViewCountForUri, selectBanStateForUri } from 'lbryinc';
|
|
import { selectShowMatureContent } from 'redux/selectors/settings';
|
|
import ClaimPreviewTile from './view';
|
|
import formatMediaDuration from 'util/formatMediaDuration';
|
|
|
|
const select = (state, props) => {
|
|
const claim = props.uri && makeSelectClaimForUri(props.uri)(state);
|
|
const media = claim && claim.value && (claim.value.video || claim.value.audio);
|
|
const mediaDuration = media && media.duration && formatMediaDuration(media.duration, { screenReader: true });
|
|
|
|
return {
|
|
claim,
|
|
mediaDuration,
|
|
date: props.uri && selectDateForUri(state, props.uri),
|
|
channel: props.uri && makeSelectChannelForClaimUri(props.uri)(state),
|
|
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
|
|
thumbnail: getThumbnailFromClaim(claim),
|
|
title: props.uri && makeSelectTitleForUri(props.uri)(state),
|
|
banState: selectBanStateForUri(state, props.uri),
|
|
blockedChannelUris: selectMutedChannels(state),
|
|
showMature: selectShowMatureContent(state),
|
|
isMature: makeSelectClaimIsNsfw(props.uri)(state),
|
|
viewCount: selectViewCountForUri(state, props.uri),
|
|
};
|
|
};
|
|
|
|
const perform = (dispatch) => ({
|
|
resolveUri: (uri) => dispatch(doResolveUri(uri)),
|
|
getFile: (uri) => dispatch(doFileGet(uri, false)),
|
|
});
|
|
|
|
export default connect(select, perform)(ClaimPreviewTile);
|