2017-06-06 23:19:12 +02:00
|
|
|
import React from "react";
|
|
|
|
import { connect } from "react-redux";
|
2017-09-07 23:18:33 +02:00
|
|
|
import { selectPlatform } from "selectors/app";
|
2017-09-08 05:15:05 +02:00
|
|
|
import { makeSelectFileInfoForUri } from "selectors/file_info";
|
2017-06-06 23:19:12 +02:00
|
|
|
import { makeSelectCostInfoForUri } from "selectors/cost_info";
|
2017-09-07 23:18:33 +02:00
|
|
|
import { doOpenModal } from "actions/app";
|
2017-06-06 23:19:12 +02:00
|
|
|
import { doFetchAvailability } from "actions/availability";
|
2017-09-07 15:38:44 +02:00
|
|
|
import { doOpenFileInShell, doOpenFileInFolder } from "actions/file_info";
|
2017-09-08 05:15:05 +02:00
|
|
|
import { makeSelectClaimIsMine } from "selectors/claims";
|
2017-07-25 10:43:44 +02:00
|
|
|
import { doPurchaseUri, doLoadVideo, doStartDownload } from "actions/content";
|
2017-09-07 15:38:44 +02:00
|
|
|
import { doNavigate } from "actions/navigation";
|
2017-06-06 23:19:12 +02:00
|
|
|
import FileActions from "./view";
|
2017-04-29 11:50:29 +02:00
|
|
|
|
2017-09-08 05:15:05 +02:00
|
|
|
const select = (state, props) => ({
|
|
|
|
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
|
|
|
/*availability check is disabled due to poor performance, TBD if it dies forever or requires daemon fix*/
|
|
|
|
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
|
|
|
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
|
|
|
});
|
2017-04-29 11:50:29 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
const perform = dispatch => ({
|
2017-06-06 23:19:12 +02:00
|
|
|
checkAvailability: uri => dispatch(doFetchAvailability(uri)),
|
|
|
|
openInShell: fileInfo => dispatch(doOpenFileInShell(fileInfo)),
|
2017-09-08 05:15:05 +02:00
|
|
|
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
|
|
|
startDownload: uri => dispatch(doPurchaseUri(uri)),
|
2017-07-25 10:43:44 +02:00
|
|
|
restartDownload: (uri, outpoint) => dispatch(doStartDownload(uri, outpoint)),
|
2017-09-17 03:50:44 +02:00
|
|
|
editClaim: claimId => dispatch(doNavigate("/publish", { id: claimId })),
|
2017-06-06 06:21:55 +02:00
|
|
|
});
|
2017-04-29 19:02:25 +02:00
|
|
|
|
2017-09-08 05:15:05 +02:00
|
|
|
export default connect(select, perform)(FileActions);
|