bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/modal/remove-user/component.jsx

101 lines
2.8 KiB
React
Raw Normal View History

2020-05-22 22:35:24 +08:00
import React, { Component } from 'react';
import { defineMessages } from 'react-intl';
import PropTypes from 'prop-types';
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
2020-05-23 00:39:54 +08:00
className={styles.banUserCheckBox}
2020-05-22 22:35:24 +08:00
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"
2020-05-23 00:39:54 +08:00
className={styles.confirmBtn}
2020-05-22 22:35:24 +08:00
label={intl.formatMessage(messages.yesLabel)}
onClick={() => {
2020-05-23 00:39:54 +08:00
onConfirm(user.userId, checked);
2020-05-22 22:35:24 +08:00
mountModal(null);
}}
/>
<Button
label={intl.formatMessage(messages.noLabel)}
2020-05-23 00:39:54 +08:00
className={styles.dismissBtn}
2020-05-22 22:35:24 +08:00
onClick={() => mountModal(null)}
/>
</div>
</div>
</Modal>
);
}
}
RemoveUserModal.propTypes = propTypes;
export default withModalMounter(RemoveUserModal);