lbry-desktop/src/renderer/js/modal/modalRemoveFile/view.jsx

77 lines
1.8 KiB
React
Raw Normal View History

2017-07-02 20:23:38 +02:00
import React from "react";
import { Modal } from "modal/modal";
import FormField from "component/formField/index";
2017-07-02 20:23:38 +02:00
class ModalRemoveFile extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
deleteChecked: false,
abandonClaimChecked: false,
};
}
handleDeleteCheckboxClicked(event) {
this.setState({
deleteChecked: event.target.checked,
});
}
handleAbandonClaimCheckboxClicked(event) {
this.setState({
abandonClaimChecked: event.target.checked,
});
}
render() {
2017-09-08 05:15:05 +02:00
const {
claimIsMine,
closeModal,
deleteFile,
fileInfo: { outpoint },
2017-09-17 22:33:52 +02:00
title,
2017-09-08 05:15:05 +02:00
} = this.props;
2017-07-02 20:23:38 +02:00
const { deleteChecked, abandonClaimChecked } = this.state;
return (
<Modal
isOpen={true}
contentLabel={__("Confirm File Remove")}
type="confirm"
confirmButtonLabel={__("Remove")}
onConfirmed={() =>
deleteFile(outpoint, deleteChecked, abandonClaimChecked)
}
2017-07-02 20:23:38 +02:00
onAborted={closeModal}
>
<p>
{__("Are you sure you'd like to remove")} <cite>{title}</cite>{" "}
{__("from LBRY?")}
</p>
<section>
2017-10-15 01:41:41 +02:00
<FormField
type="checkbox"
checked={deleteChecked}
onClick={this.handleDeleteCheckboxClicked.bind(this)}
label={__("Delete this file from my computer")}
/>
2017-07-02 20:23:38 +02:00
</section>
{claimIsMine && (
2017-07-02 20:23:38 +02:00
<section>
2017-10-15 01:41:41 +02:00
<FormField
type="checkbox"
checked={abandonClaimChecked}
onClick={this.handleAbandonClaimCheckboxClicked.bind(this)}
label={__("Abandon the claim for this URI")}
/>
</section>
)}
2017-07-02 20:23:38 +02:00
</Modal>
);
}
}
export default ModalRemoveFile;