2019-06-28 09:27:55 +02:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import {
|
|
|
|
doResolveUri,
|
|
|
|
makeSelectClaimForUri,
|
|
|
|
makeSelectIsUriResolving,
|
|
|
|
makeSelectClaimIsMine,
|
|
|
|
makeSelectClaimIsPending,
|
2020-01-14 21:44:07 +01:00
|
|
|
makeSelectCoverForUri,
|
2019-06-28 09:27:55 +02:00
|
|
|
makeSelectClaimIsNsfw,
|
2019-07-08 22:54:58 +02:00
|
|
|
selectBlockedChannels,
|
|
|
|
selectChannelIsBlocked,
|
2020-01-07 22:07:12 +01:00
|
|
|
doFileGet,
|
2020-05-07 14:22:55 +02:00
|
|
|
makeSelectReflectingClaimForUri,
|
2020-05-11 17:54:39 +02:00
|
|
|
makeSelectClaimWasPurchased,
|
2020-05-21 17:38:28 +02:00
|
|
|
makeSelectStreamingUrlForUri,
|
2019-06-28 09:27:55 +02:00
|
|
|
} from 'lbry-redux';
|
2019-07-17 05:32:29 +02:00
|
|
|
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
|
2019-10-17 18:58:28 +02:00
|
|
|
import { selectShowMatureContent } from 'redux/selectors/settings';
|
2020-05-21 17:38:28 +02:00
|
|
|
import { makeSelectHasVisitedUri } from 'redux/selectors/content';
|
2019-07-08 22:54:58 +02:00
|
|
|
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
2019-06-28 09:27:55 +02:00
|
|
|
import ClaimPreview from './view';
|
|
|
|
|
|
|
|
const select = (state, props) => ({
|
2019-08-19 06:49:54 +02:00
|
|
|
pending: props.uri && makeSelectClaimIsPending(props.uri)(state),
|
|
|
|
claim: props.uri && makeSelectClaimForUri(props.uri)(state),
|
2020-05-07 14:22:55 +02:00
|
|
|
reflectingInfo: props.uri && makeSelectReflectingClaimForUri(props.uri)(state),
|
2019-08-02 08:28:14 +02:00
|
|
|
obscureNsfw: !selectShowMatureContent(state),
|
2019-08-19 06:49:54 +02:00
|
|
|
claimIsMine: props.uri && makeSelectClaimIsMine(props.uri)(state),
|
|
|
|
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
|
2020-01-14 21:44:07 +01:00
|
|
|
cover: props.uri && makeSelectCoverForUri(props.uri)(state),
|
2019-08-19 06:49:54 +02:00
|
|
|
nsfw: props.uri && makeSelectClaimIsNsfw(props.uri)(state),
|
2019-06-28 09:27:55 +02:00
|
|
|
blackListedOutpoints: selectBlackListedOutpoints(state),
|
2019-07-17 05:32:29 +02:00
|
|
|
filteredOutpoints: selectFilteredOutpoints(state),
|
2019-07-08 22:54:58 +02:00
|
|
|
blockedChannelUris: selectBlockedChannels(state),
|
2019-08-19 06:49:54 +02:00
|
|
|
hasVisitedUri: props.uri && makeSelectHasVisitedUri(props.uri)(state),
|
|
|
|
channelIsBlocked: props.uri && selectChannelIsBlocked(props.uri)(state),
|
|
|
|
isSubscribed: props.uri && makeSelectIsSubscribed(props.uri, true)(state),
|
2020-05-21 17:38:28 +02:00
|
|
|
streamingUrl: props.uri && makeSelectStreamingUrlForUri(props.uri)(state),
|
2020-05-11 17:54:39 +02:00
|
|
|
wasPurchased: props.uri && makeSelectClaimWasPurchased(props.uri)(state),
|
2019-06-28 09:27:55 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
const perform = dispatch => ({
|
|
|
|
resolveUri: uri => dispatch(doResolveUri(uri)),
|
2020-01-07 22:07:12 +01:00
|
|
|
getFile: uri => dispatch(doFileGet(uri, false)),
|
2019-06-28 09:27:55 +02:00
|
|
|
});
|
|
|
|
|
2020-04-01 20:43:50 +02:00
|
|
|
export default connect(select, perform)(ClaimPreview);
|