2019-06-13 04:26:40 +02:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import {
|
2021-12-31 18:52:26 +01:00
|
|
|
selectClaimIsMine,
|
2022-01-20 02:46:01 +01:00
|
|
|
selectTitleForUri,
|
|
|
|
getThumbnailFromClaim,
|
2021-12-31 18:52:26 +01:00
|
|
|
selectClaimForUri,
|
2022-01-20 02:46:01 +01:00
|
|
|
selectIsUriResolving,
|
2019-06-13 04:26:40 +02:00
|
|
|
makeSelectMetadataItemForUri,
|
2021-10-08 05:47:39 +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-12-31 18:52:26 +01:00
|
|
|
const claim = selectClaimForUri(state, props.uri);
|
|
|
|
|
2019-06-13 04:26:40 +02:00
|
|
|
return {
|
|
|
|
uri: props.uri,
|
2021-12-31 18:52:26 +01:00
|
|
|
claim,
|
2022-01-20 02:46:01 +01:00
|
|
|
title: selectTitleForUri(state, props.uri),
|
|
|
|
thumbnail: getThumbnailFromClaim(claim),
|
2019-06-13 04:26:40 +02:00
|
|
|
description: makeSelectMetadataItemForUri(props.uri, 'description')(state),
|
2021-12-31 18:52:26 +01:00
|
|
|
channelIsMine: selectClaimIsMine(state, claim),
|
2022-01-20 02:46:01 +01:00
|
|
|
isResolvingUri: selectIsUriResolving(state, props.uri),
|
2019-06-13 04:26:40 +02:00
|
|
|
blackListedOutpoints: selectBlackListedOutpoints(state),
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-10-08 05:47:39 +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);
|