2020-05-22 22:35:24 +08:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { defineMessages } from 'react-intl';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { findDOMNode } from 'react-dom';
|
|
|
|
import { withModalMounter } from '/imports/ui/components/modal/service';
|
|
|
|
import Modal from '/imports/ui/components/modal/simple/component';
|
|
|
|
import Button from '/imports/ui/components/button/component';
|
|
|
|
import { styles } from './styles';
|
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
yesLabel: {
|
|
|
|
id: 'app.endMeeting.yesLabel',
|
|
|
|
description: 'confirm button label',
|
|
|
|
},
|
|
|
|
noLabel: {
|
|
|
|
id: 'app.endMeeting.noLabel',
|
|
|
|
description: 'cancel confirm button label',
|
|
|
|
},
|
|
|
|
removeConfirmTitle: {
|
|
|
|
id: 'app.userList.menu.removeConfirmation.label',
|
|
|
|
description: 'title for remove user confirmation modal',
|
|
|
|
},
|
|
|
|
removeConfirmDesc: {
|
|
|
|
id: 'app.userlist.menu.removeConfirmation.desc',
|
|
|
|
description: 'description for remove user confirmation',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
};
|
|
|
|
|
|
|
|
class RemoveUserModal extends Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
checked: false,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
mountModal, onConfirm, user, title, intl,
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
const {
|
|
|
|
checked,
|
|
|
|
} = this.state;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Modal
|
|
|
|
overlayClassName={styles.overlay}
|
|
|
|
className={styles.modal}
|
|
|
|
onRequestClose={() => mountModal(null)}
|
|
|
|
hideBorder
|
|
|
|
contentLabel={title}
|
|
|
|
>
|
|
|
|
<div className={styles.container}>
|
|
|
|
<div className={styles.header}>
|
|
|
|
<div className={styles.title}>
|
|
|
|
{intl.formatMessage(messages.removeConfirmTitle, { 0: user.name })}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className={styles.description}>
|
2020-05-22 22:41:11 +08:00
|
|
|
<label htmlFor="banUserCheckbox" key="eject-or-ban-user">
|
2020-05-22 22:35:24 +08:00
|
|
|
<input
|
|
|
|
type="checkbox"
|
|
|
|
id="banUserCheckbox"
|
|
|
|
onChange={() => this.setState({ checked: !checked })}
|
|
|
|
checked={checked}
|
|
|
|
aria-label={intl.formatMessage(messages.removeConfirmDesc)}
|
|
|
|
/>
|
|
|
|
<span aria-hidden>{intl.formatMessage(messages.removeConfirmDesc)}</span>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className={styles.footer}>
|
|
|
|
<Button
|
|
|
|
color="primary"
|
|
|
|
className={styles.button}
|
|
|
|
label={intl.formatMessage(messages.yesLabel)}
|
|
|
|
onClick={() => {
|
|
|
|
mountModal(null);
|
|
|
|
onConfirm(user.userId, this.state.checked);
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<Button
|
|
|
|
label={intl.formatMessage(messages.noLabel)}
|
|
|
|
className={styles.button}
|
|
|
|
onClick={() => mountModal(null)}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RemoveUserModal.propTypes = propTypes;
|
|
|
|
export default withModalMounter(RemoveUserModal);
|