2019-06-13 04:26:40 +02:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import {
|
2021-11-11 05:48:10 +01:00
|
|
|
selectClaimIsMine,
|
2019-06-13 04:26:40 +02:00
|
|
|
makeSelectTitleForUri,
|
|
|
|
makeSelectThumbnailForUri,
|
2021-11-11 05:48:10 +01:00
|
|
|
selectClaimForUri,
|
2019-06-13 04:26:40 +02:00
|
|
|
makeSelectIsUriResolving,
|
|
|
|
makeSelectMetadataItemForUri,
|
2021-10-17 10:36:14 +02:00
|
|
|
} from 'redux/selectors/claims';
|
|
|
|
import { doResolveUri } from 'redux/actions/claims';
|
2019-06-13 04:26:40 +02:00
|
|
|
import { selectBlackListedOutpoints } from 'lbryinc';
|
|
|
|
import PreviewLink from './view';
|
|
|
|
|
|
|
|
const select = (state, props) => {
|
2021-11-11 05:48:10 +01:00
|
|
|
const claim = selectClaimForUri(state, props.uri);
|
|
|
|
|
2019-06-13 04:26:40 +02:00
|
|
|
return {
|
|
|
|
uri: props.uri,
|
2021-11-11 05:48:10 +01:00
|
|
|
claim,
|
2019-06-13 04:26:40 +02:00
|
|
|
title: makeSelectTitleForUri(props.uri)(state),
|
|
|
|
thumbnail: makeSelectThumbnailForUri(props.uri)(state),
|
|
|
|
description: makeSelectMetadataItemForUri(props.uri, 'description')(state),
|
2021-11-11 05:48:10 +01:00
|
|
|
channelIsMine: selectClaimIsMine(state, claim),
|
2019-06-13 04:26:40 +02:00
|
|
|
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
|
|
|
|
blackListedOutpoints: selectBlackListedOutpoints(state),
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
const perform = (dispatch) => ({
|
|
|
|
resolveUri: (uri) => dispatch(doResolveUri(uri)),
|
2019-06-13 04:26:40 +02:00
|
|
|
});
|
|
|
|
|
2020-06-15 22:33:03 +02:00
|
|
|
export default connect(select, perform)(PreviewLink);
|