1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-07-18 17:22:05 +00:00
seahub/frontend/src/components/dialog/upload-remind-dialog.js

43 lines
1.5 KiB
JavaScript
Raw Normal View History

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 {
toggle = () => {
this.props.cancelFileUpload();
}
render() {
let title = gettext('Replace file {filename}?');
title = title.replace('{filename}', '<span class="a-simaulte">' + this.props.currentResumableFile.fileName + '</span>');
return (
<Modal isOpen={true} toggle={this.toggle}>
<ModalHeader toggle={this.toggle} ><div dangerouslySetInnerHTML={{__html: title}}></div></ModalHeader>
<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>
<Button outline color="primary" onClick={this.props.replaceRepetitionFile}>{gettext('Replace')}</Button>
<Button outline color="info" onClick={this.props.uploadFile}>{gettext("Don't replace")}</Button>
2018-11-14 02:55:11 +00:00
<Button outline color="danger" onClick={this.toggle}>{gettext('Cancel')}</Button>
</ModalFooter>
</Modal>
);
}
}
UploadRemindDialog.propTypes = propTypes;
export default UploadRemindDialog;