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';
|
2022-03-03 01:11:05 +08:00
|
|
|
import ConfirmationModal from '/imports/ui/components/common/modal/confirmation/component';
|
2019-01-15 05:39:03 +08:00
|
|
|
|
|
|
|
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',
|
|
|
|
},
|
2022-11-30 19:31:37 +08:00
|
|
|
confirmButtonLabel: {
|
|
|
|
id: 'app.endMeeting.yesLabel',
|
|
|
|
description: 'end meeting confirm button label',
|
|
|
|
},
|
2019-01-15 05:39:03 +08:00
|
|
|
});
|
|
|
|
|
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
|
|
|
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 {
|
2022-03-03 01:11:05 +08:00
|
|
|
users, intl, endMeeting, meetingTitle,
|
2020-06-26 20:45:03 +08:00
|
|
|
} = this.props;
|
2019-01-15 05:39:03 +08:00
|
|
|
|
2022-03-03 01:11:05 +08:00
|
|
|
const title = intl.formatMessage(intlMessages.endMeetingTitle, { 0: meetingTitle });
|
|
|
|
|
|
|
|
let description = users > 0
|
|
|
|
? intl.formatMessage(intlMessages.endMeetingDescription, { 0: users })
|
|
|
|
: intl.formatMessage(intlMessages.endMeetingNoUserDescription);
|
|
|
|
|
|
|
|
if (warnAboutUnsavedContentOnMeetingEnd) {
|
2022-04-07 01:27:05 +08:00
|
|
|
// the double breakline it to put one empty line between the descriptions
|
|
|
|
description += `\n\n${intl.formatMessage(intlMessages.contentWarning)}`;
|
2022-03-03 01:11:05 +08:00
|
|
|
}
|
|
|
|
|
2019-01-15 05:39:03 +08:00
|
|
|
return (
|
2022-03-03 01:11:05 +08:00
|
|
|
<ConfirmationModal
|
|
|
|
intl={intl}
|
|
|
|
onConfirm={endMeeting}
|
|
|
|
title={title}
|
|
|
|
description={description}
|
|
|
|
confirmButtonColor="danger"
|
|
|
|
confirmButtonDataTest="confirmEndMeeting"
|
2022-11-30 19:31:37 +08:00
|
|
|
confirmButtonLabel={intl.formatMessage(intlMessages.confirmButtonLabel)}
|
2022-03-03 01:11:05 +08:00
|
|
|
/>
|
2019-01-15 05:39:03 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EndMeetingComponent.propTypes = propTypes;
|
|
|
|
|
2021-01-23 03:48:50 +08:00
|
|
|
export default injectIntl(EndMeetingComponent);
|