2017-12-21 22:08:54 +01:00
|
|
|
import { connect } from 'react-redux';
|
2021-10-17 10:36:14 +02:00
|
|
|
import { normalizeURI } from 'util/lbryURI';
|
|
|
|
import { doResolveUri } from 'redux/actions/claims';
|
2022-03-09 19:05:37 +01:00
|
|
|
import { selectIsUriResolving, selectClaimForUri, selectOdyseeMembershipForUri } from 'redux/selectors/claims';
|
2017-12-21 22:08:54 +01:00
|
|
|
import UriIndicator from './view';
|
2017-05-02 07:25:31 +02:00
|
|
|
|
2022-03-09 14:47:18 +01:00
|
|
|
const select = (state, props) => {
|
|
|
|
let uri = null;
|
|
|
|
try {
|
|
|
|
uri = normalizeURI(props.uri);
|
|
|
|
} catch {}
|
|
|
|
|
|
|
|
return {
|
|
|
|
claim: selectClaimForUri(state, props.uri),
|
|
|
|
isResolvingUri: selectIsUriResolving(state, props.uri),
|
|
|
|
uri,
|
2022-03-09 19:05:37 +01:00
|
|
|
odyseeMembership: selectOdyseeMembershipForUri(state, props.uri),
|
2022-03-09 14:47:18 +01:00
|
|
|
};
|
|
|
|
};
|
2017-05-02 07:25:31 +02:00
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
const perform = (dispatch) => ({
|
|
|
|
resolveUri: (uri) => dispatch(doResolveUri(uri)),
|
2017-06-06 06:21:55 +02:00
|
|
|
});
|
2017-05-21 16:42:34 +02:00
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
export default connect(select, perform)(UriIndicator);
|