1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-07 09:51:26 +00:00

[user settings] rewrote it with react

This commit is contained in:
llj
2019-05-07 14:57:22 +08:00
parent 18aa3f30e9
commit f4725faf0b
18 changed files with 991 additions and 1 deletions

View File

@@ -0,0 +1,54 @@
import React from 'react';
import { gettext, siteRoot } from '../../utils/constants';
import ModalPortal from '../modal-portal';
import ConfirmDeleteAccount from '../dialog/confirm-delete-account';
const {
csrfToken
} = window.app.pageOptions;
class DeleteAccount extends React.Component {
constructor(props) {
super(props);
this.state = {
isConfirmDialogOpen: false
};
}
confirmDelete = (e) => {
e.preventDefault();
this.setState({
isConfirmDialogOpen: true
});
}
toggleDialog = () => {
this.setState({
isConfirmDialogOpen: !this.state.isConfirmDialogOpen
});
}
render() {
return (
<React.Fragment>
<div className="setting-item" id="del-account">
<h3 className="setting-item-heading">{gettext('Delete Account')}</h3>
<p className="mb-2">{gettext('This operation will not be reverted. Please think twice!')}</p>
<button className="btn btn-secondary" onClick={this.confirmDelete}>{gettext('Delete')}</button>
</div>
{this.state.isConfirmDialogOpen && (
<ModalPortal>
<ConfirmDeleteAccount
formActionURL={`${siteRoot}profile/delete/`}
csrfToken={csrfToken}
toggle={this.toggleDialog}
/>
</ModalPortal>
)}
</React.Fragment>
);
}
}
export default DeleteAccount;