2017-12-21 22:08:54 +01:00
|
|
|
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,
|
2018-08-22 19:17:11 +02:00
|
|
|
makeSelectClaimForUri,
|
2018-04-18 06:03:01 +02:00
|
|
|
} from 'lbry-redux';
|
|
|
|
import { doOpenFileInShell } from 'redux/actions/file';
|
2017-12-21 22:08:54 +01:00
|
|
|
import { doPurchaseUri, doStartDownload } from 'redux/actions/content';
|
2018-01-06 00:57:24 +01:00
|
|
|
import { doPause } from 'redux/actions/media';
|
2017-12-21 22:08:54 +01:00
|
|
|
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),
|
2018-08-22 19:17:11 +02:00
|
|
|
claim: makeSelectClaimForUri(props.uri)(state),
|
2017-09-08 05:15:05 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
const perform = dispatch => ({
|
2017-09-20 14:47:08 +02:00
|
|
|
openInShell: path => dispatch(doOpenFileInShell(path)),
|
2017-09-18 04:08:43 +02:00
|
|
|
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
|
|
|
});
|
|
|
|
|
2018-08-22 19:17:11 +02:00
|
|
|
export default connect(
|
|
|
|
select,
|
|
|
|
perform
|
|
|
|
)(FileDownloadLink);
|