2019-12-30 20:54:53 +01:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import EmbedWrapperPage from './view';
|
2020-01-27 22:37:54 +01:00
|
|
|
import { doResolveUri, makeSelectClaimForUri, buildURI } from 'lbry-redux';
|
2020-01-31 20:33:40 +01:00
|
|
|
import { doAnalyticsView } from 'redux/actions/app';
|
2019-12-30 20:54:53 +01:00
|
|
|
|
|
|
|
const select = (state, props) => {
|
|
|
|
const { match } = props;
|
|
|
|
const { params } = match;
|
|
|
|
const { claimName, claimId } = params;
|
2020-01-27 22:37:54 +01:00
|
|
|
const uri = claimName && claimId ? buildURI({ claimName, claimId }) : '';
|
2019-12-30 20:54:53 +01:00
|
|
|
return {
|
|
|
|
uri,
|
|
|
|
claim: makeSelectClaimForUri(uri)(state),
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-01-31 20:33:40 +01:00
|
|
|
const perform = dispatch => {
|
|
|
|
return {
|
|
|
|
resolveUri: uri => dispatch(doResolveUri(uri)),
|
|
|
|
triggerAnalyticsView: uri => dispatch(doAnalyticsView(uri)),
|
|
|
|
};
|
|
|
|
};
|
2019-12-30 20:54:53 +01:00
|
|
|
|
|
|
|
export default connect(
|
|
|
|
select,
|
|
|
|
perform
|
|
|
|
)(EmbedWrapperPage);
|