lbry-desktop/ui/page/embedWrapper/index.js

37 lines
1.1 KiB
JavaScript
Raw Normal View History

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