lbry-desktop/src/renderer/component/fileDownloadLink/index.js

34 lines
1.2 KiB
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
2017-09-08 05:15:05 +02:00
import {
makeSelectFileInfoForUri,
makeSelectDownloadingForUri,
makeSelectLoadingForUri,
2018-04-18 06:03:01 +02:00
makeSelectCostInfoForUri,
makeSelectClaimForUri,
2018-04-18 06:03:01 +02:00
} from 'lbry-redux';
import { doOpenFileInShell } from 'redux/actions/file';
import { doPurchaseUri, doStartDownload } from 'redux/actions/content';
2018-01-06 00:57:24 +01:00
import { doPause } from 'redux/actions/media';
import FileDownloadLink from './view';
2017-09-08 05:15:05 +02:00
const select = (state, props) => ({
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
2017-12-13 22:36:30 +01:00
/* availability check is disabled due to poor performance, TBD if it dies forever or requires daemon fix */
2017-09-08 05:15:05 +02:00
downloading: makeSelectDownloadingForUri(props.uri)(state),
costInfo: makeSelectCostInfoForUri(props.uri)(state),
loading: makeSelectLoadingForUri(props.uri)(state),
claim: makeSelectClaimForUri(props.uri)(state),
2017-09-08 05:15:05 +02:00
});
const perform = dispatch => ({
openInShell: path => dispatch(doOpenFileInShell(path)),
purchaseUri: uri => dispatch(doPurchaseUri(uri)),
2017-09-08 05:15:05 +02:00
restartDownload: (uri, outpoint) => dispatch(doStartDownload(uri, outpoint)),
2017-12-21 00:38:11 +01:00
doPause: () => dispatch(doPause()),
2017-09-08 05:15:05 +02:00
});
export default connect(
select,
perform
)(FileDownloadLink);