lbry-desktop/ui/js/modal/modalRemoveFile/index.js

26 lines
860 B
JavaScript
Raw Normal View History

2017-07-02 20:23:38 +02:00
import React from "react";
import { connect } from "react-redux";
import { doCloseModal } from "actions/app";
import { doDeleteFileAndGoBack } from "actions/file_info";
2017-09-08 05:15:05 +02:00
import {
makeSelectMetadataForUri,
makeSelectClaimIsMine,
} from "selectors/claims";
import { makeSelectFileInfoForUri } from "selectors/file_info";
2017-07-02 20:23:38 +02:00
import ModalRemoveFile from "./view";
2017-09-07 23:18:33 +02:00
const select = (state, props) => ({
2017-09-08 05:15:05 +02:00
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
metadata: makeSelectMetadataForUri(props.uri)(state),
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
2017-09-07 23:18:33 +02:00
});
2017-07-02 20:23:38 +02:00
const perform = dispatch => ({
closeModal: () => dispatch(doCloseModal()),
deleteFile: (fileInfo, deleteFromComputer, abandonClaim) => {
dispatch(doDeleteFileAndGoBack(fileInfo, deleteFromComputer, abandonClaim));
2017-07-02 20:23:38 +02:00
},
});
2017-09-07 23:18:33 +02:00
export default connect(select, perform)(ModalRemoveFile);