2018-11-14 02:55:11 +00:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { gettext } from '../../utils/constants';
|
|
|
|
import { Modal, ModalHeader, ModalBody, ModalFooter, Button } from 'reactstrap';
|
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
currentResumableFile: PropTypes.object.isRequired,
|
|
|
|
replaceRepetitionFile: PropTypes.func.isRequired,
|
|
|
|
uploadFile: PropTypes.func.isRequired,
|
|
|
|
cancelFileUpload: PropTypes.func.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
class UploadRemindDialog extends React.Component {
|
|
|
|
|
2019-01-05 03:43:33 +00:00
|
|
|
toggle = (e) => {
|
|
|
|
e.nativeEvent.stopImmediatePropagation();
|
2018-11-14 02:55:11 +00:00
|
|
|
this.props.cancelFileUpload();
|
|
|
|
}
|
|
|
|
|
2019-01-05 03:43:33 +00:00
|
|
|
replaceRepetitionFile = (e) => {
|
|
|
|
e.nativeEvent.stopImmediatePropagation();
|
|
|
|
this.props.replaceRepetitionFile();
|
|
|
|
}
|
|
|
|
|
|
|
|
uploadFile = (e) => {
|
|
|
|
e.nativeEvent.stopImmediatePropagation();
|
|
|
|
this.props.uploadFile();
|
|
|
|
}
|
|
|
|
|
2018-11-14 02:55:11 +00:00
|
|
|
render() {
|
2022-09-08 08:42:55 +00:00
|
|
|
const { fileName } = this.props.currentResumableFile;
|
2018-11-14 02:55:11 +00:00
|
|
|
return (
|
|
|
|
<Modal isOpen={true} toggle={this.toggle}>
|
2022-10-09 10:32:03 +00:00
|
|
|
<ModalHeader toggle={this.toggle}>
|
|
|
|
<span>{gettext('Replace file {filename}?').replace('{filename}', fileName)}</span>
|
|
|
|
</ModalHeader>
|
2018-11-14 02:55:11 +00:00
|
|
|
<ModalBody>
|
|
|
|
<p>{gettext('A file with the same name already exists in this folder.')}</p>
|
|
|
|
<p>{gettext('Replacing it will overwrite its content.')}</p>
|
|
|
|
</ModalBody>
|
|
|
|
<ModalFooter>
|
2019-05-28 02:22:49 +00:00
|
|
|
<Button color="primary" onClick={this.replaceRepetitionFile}>{gettext('Replace')}</Button>
|
|
|
|
<Button color="primary" onClick={this.uploadFile}>{gettext('Don\'t replace')}</Button>
|
|
|
|
<Button color="secondary" onClick={this.toggle}>{gettext('Cancel')}</Button>
|
2018-11-14 02:55:11 +00:00
|
|
|
</ModalFooter>
|
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
UploadRemindDialog.propTypes = propTypes;
|
|
|
|
|
|
|
|
export default UploadRemindDialog;
|