2019-12-30 20:54:53 +01:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import EmbedWrapperPage from './view';
|
2020-05-22 03:26:46 +02:00
|
|
|
import {
|
|
|
|
doResolveUri,
|
|
|
|
makeSelectClaimForUri,
|
|
|
|
buildURI,
|
|
|
|
makeSelectStreamingUrlForUri,
|
|
|
|
makeSelectIsUriResolving,
|
|
|
|
} from 'lbry-redux';
|
2020-05-21 23:11:56 +02:00
|
|
|
import { doPlayUri } from 'redux/actions/content';
|
2020-05-22 03:26:46 +02:00
|
|
|
import { makeSelectCostInfoForUri, doFetchCostInfoForUri } from 'lbryinc';
|
2019-12-30 20:54:53 +01:00
|
|
|
|
|
|
|
const select = (state, props) => {
|
|
|
|
const { match } = props;
|
|
|
|
const { params } = match;
|
|
|
|
const { claimName, claimId } = params;
|
2020-06-12 23:23:16 +02:00
|
|
|
const uri = claimName ? buildURI({ claimName, claimId }) : '';
|
2019-12-30 20:54:53 +01:00
|
|
|
return {
|
|
|
|
uri,
|
|
|
|
claim: makeSelectClaimForUri(uri)(state),
|
2020-05-22 03:26:46 +02:00
|
|
|
costInfo: makeSelectCostInfoForUri(uri)(state),
|
|
|
|
streamingUrl: makeSelectStreamingUrlForUri(uri)(state),
|
|
|
|
isResolvingUri: makeSelectIsUriResolving(uri)(state),
|
2019-12-30 20:54:53 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-01-31 20:33:40 +01:00
|
|
|
const perform = dispatch => {
|
|
|
|
return {
|
|
|
|
resolveUri: uri => dispatch(doResolveUri(uri)),
|
2020-05-21 23:11:56 +02:00
|
|
|
doPlayUri: uri => dispatch(doPlayUri(uri)),
|
2020-05-22 03:26:46 +02:00
|
|
|
doFetchCostInfoForUri: uri => dispatch(doFetchCostInfoForUri(uri)),
|
2020-01-31 20:33:40 +01:00
|
|
|
};
|
|
|
|
};
|
2019-12-30 20:54:53 +01:00
|
|
|
|
2020-04-14 01:48:11 +02:00
|
|
|
export default connect(select, perform)(EmbedWrapperPage);
|