2019-06-28 09:27:55 +02:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import {
|
|
|
|
doResolveUri,
|
|
|
|
makeSelectClaimForUri,
|
|
|
|
makeSelectIsUriResolving,
|
|
|
|
makeSelectClaimIsMine,
|
|
|
|
makeSelectClaimIsPending,
|
|
|
|
makeSelectClaimIsNsfw,
|
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,
|
2021-03-26 00:52:28 +01:00
|
|
|
makeSelectClaimIsStreamPlaceholder,
|
2019-06-28 09:27:55 +02:00
|
|
|
} from 'lbry-redux';
|
2021-03-03 19:50:16 +01:00
|
|
|
import { selectMutedChannels, makeSelectChannelIsMuted } from 'redux/selectors/blocked';
|
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';
|
2021-03-03 19:50:16 +01:00
|
|
|
import { selectModerationBlockList } from 'redux/selectors/comments';
|
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-12-22 16:16:39 +01:00
|
|
|
reflectingProgress: props.uri && makeSelectReflectingClaimForUri(props.uri)(state),
|
2021-01-26 17:55:27 +01:00
|
|
|
obscureNsfw: selectShowMatureContent(state) === false,
|
2019-08-19 06:49:54 +02:00
|
|
|
claimIsMine: props.uri && makeSelectClaimIsMine(props.uri)(state),
|
|
|
|
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
|
2020-12-22 16:16:39 +01:00
|
|
|
isResolvingRepost: props.uri && makeSelectIsUriResolving(props.repostUrl)(state),
|
|
|
|
repostClaim: props.uri && makeSelectClaimForUri(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),
|
2021-03-03 19:50:16 +01:00
|
|
|
mutedUris: selectMutedChannels(state),
|
|
|
|
blockedUris: selectModerationBlockList(state),
|
2019-08-19 06:49:54 +02:00
|
|
|
hasVisitedUri: props.uri && makeSelectHasVisitedUri(props.uri)(state),
|
2021-03-03 19:50:16 +01:00
|
|
|
channelIsBlocked: props.uri && makeSelectChannelIsMuted(props.uri)(state),
|
2019-08-19 06:49:54 +02:00
|
|
|
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),
|
2021-03-26 00:52:28 +01:00
|
|
|
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
2019-06-28 09:27:55 +02:00
|
|
|
});
|
|
|
|
|
2021-03-03 19:50:16 +01:00
|
|
|
const perform = (dispatch) => ({
|
|
|
|
resolveUri: (uri) => dispatch(doResolveUri(uri)),
|
|
|
|
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);
|