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

33 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,
makeSelectClaimForUri,
2018-04-18 06:03:01 +02:00
} from 'lbry-redux';
2019-03-12 20:53:55 +01:00
import { makeSelectCostInfoForUri } from 'lbryinc';
2018-04-18 06:03:01 +02:00
import { doOpenFileInShell } from 'redux/actions/file';
import { doPurchaseUri, doStartDownload, doSetPlayingUri } from 'redux/actions/content';
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)),
pause: () => dispatch(doSetPlayingUri(null)),
2017-09-08 05:15:05 +02:00
});
export default connect(
select,
perform
)(FileDownloadLink);