2021-05-12 01:34:18 +08:00
|
|
|
import React, { PureComponent } from 'react';
|
2019-01-15 05:39:03 +08:00
|
|
|
import PropTypes from 'prop-types';
|
2020-05-26 04:00:13 +08:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2019-01-15 05:39:03 +08:00
|
|
|
import Button from '/imports/ui/components/button/component';
|
|
|
|
import Modal from '/imports/ui/components/modal/simple/component';
|
|
|
|
import { styles } from './styles';
|
|
|
|
|
|
|
|
const intlMessages = defineMessages({
|
|
|
|
endMeetingTitle: {
|
|
|
|
id: 'app.endMeeting.title',
|
|
|
|
description: 'end meeting title',
|
|
|
|
},
|
|
|
|
endMeetingDescription: {
|
|
|
|
id: 'app.endMeeting.description',
|
2021-03-09 03:14:09 +08:00
|
|
|
description: 'end meeting description with affected users information',
|
|
|
|
},
|
|
|
|
endMeetingNoUserDescription: {
|
|
|
|
id: 'app.endMeeting.noUserDescription',
|
2019-01-15 05:39:03 +08:00
|
|
|
description: 'end meeting description',
|
|
|
|
},
|
2021-05-12 01:34:18 +08:00
|
|
|
contentWarning: {
|
|
|
|
id: 'app.endMeeting.contentWarning',
|
|
|
|
description: 'end meeting content warning',
|
|
|
|
},
|
2019-01-15 05:39:03 +08:00
|
|
|
yesLabel: {
|
|
|
|
id: 'app.endMeeting.yesLabel',
|
|
|
|
description: 'label for yes button for end meeting',
|
|
|
|
},
|
|
|
|
noLabel: {
|
|
|
|
id: 'app.endMeeting.noLabel',
|
|
|
|
description: 'label for no button for end meeting',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2021-05-12 01:34:18 +08:00
|
|
|
const { warnAboutUnsavedContentOnMeetingEnd } = Meteor.settings.public.app;
|
|
|
|
|
2019-01-15 05:39:03 +08:00
|
|
|
const propTypes = {
|
2021-01-21 04:49:07 +08:00
|
|
|
intl: PropTypes.shape({
|
|
|
|
formatMessage: PropTypes.func.isRequired,
|
|
|
|
}).isRequired,
|
2019-01-15 05:39:03 +08:00
|
|
|
closeModal: PropTypes.func.isRequired,
|
|
|
|
endMeeting: PropTypes.func.isRequired,
|
2021-01-23 03:48:50 +08:00
|
|
|
meetingTitle: PropTypes.string.isRequired,
|
|
|
|
users: PropTypes.number.isRequired,
|
2019-01-15 05:39:03 +08:00
|
|
|
};
|
|
|
|
|
2021-05-12 01:34:18 +08:00
|
|
|
class EndMeetingComponent extends PureComponent {
|
2019-01-15 05:39:03 +08:00
|
|
|
render() {
|
2020-06-26 20:45:03 +08:00
|
|
|
const {
|
2021-01-21 04:49:07 +08:00
|
|
|
users, intl, closeModal, endMeeting, meetingTitle,
|
2020-06-26 20:45:03 +08:00
|
|
|
} = this.props;
|
2019-01-15 05:39:03 +08:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Modal
|
|
|
|
overlayClassName={styles.overlay}
|
|
|
|
className={styles.modal}
|
2019-01-18 00:33:43 +08:00
|
|
|
onRequestClose={closeModal}
|
2019-01-15 05:39:03 +08:00
|
|
|
hideBorder
|
2021-01-21 04:49:07 +08:00
|
|
|
title={intl.formatMessage(intlMessages.endMeetingTitle, { 0: meetingTitle })}
|
2019-01-15 05:39:03 +08:00
|
|
|
>
|
|
|
|
<div className={styles.container}>
|
|
|
|
<div className={styles.description}>
|
2021-05-12 01:34:18 +08:00
|
|
|
{
|
|
|
|
users > 0
|
|
|
|
? intl.formatMessage(intlMessages.endMeetingDescription, { 0: users })
|
|
|
|
: intl.formatMessage(intlMessages.endMeetingNoUserDescription)
|
|
|
|
}
|
|
|
|
{
|
|
|
|
warnAboutUnsavedContentOnMeetingEnd
|
|
|
|
? (
|
|
|
|
<p>
|
|
|
|
{intl.formatMessage(intlMessages.contentWarning)}
|
|
|
|
</p>
|
|
|
|
) : null
|
2021-03-09 03:14:09 +08:00
|
|
|
}
|
2019-01-15 05:39:03 +08:00
|
|
|
</div>
|
|
|
|
<div className={styles.footer}>
|
|
|
|
<Button
|
2019-06-04 23:05:27 +08:00
|
|
|
data-test="confirmEndMeeting"
|
2019-01-15 05:39:03 +08:00
|
|
|
color="primary"
|
|
|
|
className={styles.button}
|
|
|
|
label={intl.formatMessage(intlMessages.yesLabel)}
|
2019-01-18 00:33:43 +08:00
|
|
|
onClick={endMeeting}
|
2019-01-15 05:39:03 +08:00
|
|
|
/>
|
|
|
|
<Button
|
|
|
|
label={intl.formatMessage(intlMessages.noLabel)}
|
|
|
|
className={styles.button}
|
2019-01-18 00:33:43 +08:00
|
|
|
onClick={closeModal}
|
2019-01-15 05:39:03 +08:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EndMeetingComponent.propTypes = propTypes;
|
|
|
|
|
2021-01-23 03:48:50 +08:00
|
|
|
export default injectIntl(EndMeetingComponent);
|