bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/end-meeting-confirmation/component.jsx

74 lines
2.2 KiB
React
Raw Normal View History

import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { defineMessages, injectIntl } from 'react-intl';
import ConfirmationModal from '/imports/ui/components/common/modal/confirmation/component';
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',
description: 'end meeting description',
},
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',
},
});
const { warnAboutUnsavedContentOnMeetingEnd } = Meteor.settings.public.app;
const propTypes = {
2021-01-21 04:49:07 +08:00
intl: PropTypes.shape({
formatMessage: PropTypes.func.isRequired,
}).isRequired,
endMeeting: PropTypes.func.isRequired,
2021-01-23 03:48:50 +08:00
meetingTitle: PropTypes.string.isRequired,
users: PropTypes.number.isRequired,
};
class EndMeetingComponent extends PureComponent {
render() {
const {
users, intl, endMeeting, meetingTitle,
} = this.props;
const title = intl.formatMessage(intlMessages.endMeetingTitle, { 0: meetingTitle });
let description = users > 0
? intl.formatMessage(intlMessages.endMeetingDescription, { 0: users })
: intl.formatMessage(intlMessages.endMeetingNoUserDescription);
if (warnAboutUnsavedContentOnMeetingEnd) {
// the double breakline it to put one empty line between the descriptions
description += `\n\n${intl.formatMessage(intlMessages.contentWarning)}`;
}
return (
<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)}
/>
);
}
}
EndMeetingComponent.propTypes = propTypes;
2021-01-23 03:48:50 +08:00
export default injectIntl(EndMeetingComponent);