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

94 lines
2.7 KiB
React
Raw Normal View History

import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { defineMessages, injectIntl } from 'react-intl';
import Styled 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',
description: 'end meeting description',
},
contentWarning: {
id: 'app.endMeeting.contentWarning',
description: 'end meeting content warning',
},
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',
},
});
const { warnAboutUnsavedContentOnMeetingEnd } = Meteor.settings.public.app;
const propTypes = {
2021-01-21 04:49:07 +08:00
intl: PropTypes.shape({
formatMessage: PropTypes.func.isRequired,
}).isRequired,
closeModal: PropTypes.func.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 {
2021-01-21 04:49:07 +08:00
users, intl, closeModal, endMeeting, meetingTitle,
} = this.props;
return (
<Styled.EndMeetingModal
2019-01-18 00:33:43 +08:00
onRequestClose={closeModal}
hideBorder
2021-01-21 04:49:07 +08:00
title={intl.formatMessage(intlMessages.endMeetingTitle, { 0: meetingTitle })}
>
<Styled.Container>
<Styled.Description>
{
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
}
</Styled.Description>
<Styled.Footer>
<Styled.EndMeetingButton
2019-06-04 23:05:27 +08:00
data-test="confirmEndMeeting"
color="danger"
label={intl.formatMessage(intlMessages.yesLabel)}
2019-01-18 00:33:43 +08:00
onClick={endMeeting}
/>
<Styled.EndMeetingButton
label={intl.formatMessage(intlMessages.noLabel)}
2019-01-18 00:33:43 +08:00
onClick={closeModal}
/>
</Styled.Footer>
</Styled.Container>
</Styled.EndMeetingModal>
);
}
}
EndMeetingComponent.propTypes = propTypes;
2021-01-23 03:48:50 +08:00
export default injectIntl(EndMeetingComponent);