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

92 lines
2.6 KiB
React
Raw Normal View History

2018-03-20 04:49:41 +08:00
import React from 'react';
2017-09-22 02:50:21 +08:00
import PropTypes from 'prop-types';
import { defineMessages, injectIntl } from 'react-intl';
2017-08-09 06:27:34 +08:00
import Button from '/imports/ui/components/button/component';
import Modal from '/imports/ui/components/modal/fullscreen/component';
2018-01-08 14:17:18 +08:00
import { styles } from './styles';
2017-09-22 02:50:21 +08:00
const propTypes = {
handleEndMeeting: PropTypes.func.isRequired,
confirmLeaving: PropTypes.func.isRequired,
intl: PropTypes.shape({
formatMessage: PropTypes.func.isRequired,
}).isRequired,
2017-09-22 02:50:21 +08:00
showEndMeeting: PropTypes.bool.isRequired,
};
const intlMessages = defineMessages({
title: {
id: 'app.leaveConfirmation.title',
2017-04-10 23:50:03 +08:00
description: 'Leave session modal title',
},
message: {
id: 'app.leaveConfirmation.message',
2017-04-10 23:50:03 +08:00
description: 'message for leaving session',
},
confirmLabel: {
id: 'app.leaveConfirmation.confirmLabel',
2017-04-10 23:50:03 +08:00
description: 'Confirmation button label',
},
confirmDesc: {
id: 'app.leaveConfirmation.confirmDesc',
2017-04-11 21:52:30 +08:00
description: 'adds context to confim option',
},
dismissLabel: {
id: 'app.leaveConfirmation.dismissLabel',
2017-04-10 23:50:03 +08:00
description: 'Dismiss button label',
},
dismissDesc: {
id: 'app.leaveConfirmation.dismissDesc',
2017-04-11 21:52:30 +08:00
description: 'adds context to dismiss option',
},
endMeetingLabel: {
id: 'app.leaveConfirmation.endMeetingLabel',
description: 'End meeting button label',
},
endMeetingAriaLabel: {
id: 'app.leaveConfirmation.endMeetingAriaLabel',
description: 'End meeting button aria label',
},
endMeetingDesc: {
id: 'app.leaveConfirmation.endMeetingDesc',
description: 'adds context to end meeting option',
},
});
2018-04-26 03:34:22 +08:00
2018-03-20 04:49:41 +08:00
const LeaveConfirmation = ({
intl,
handleEndMeeting,
showEndMeeting,
confirmLeaving,
2018-03-20 04:49:41 +08:00
}) => (
<Modal
title={intl.formatMessage(intlMessages.title)}
confirm={{
callback: confirmLeaving,
2018-03-20 04:49:41 +08:00
label: intl.formatMessage(intlMessages.confirmLabel),
description: intl.formatMessage(intlMessages.confirmDesc),
}}
dismiss={{
callback: () => null,
label: intl.formatMessage(intlMessages.dismissLabel),
description: intl.formatMessage(intlMessages.dismissDesc),
}}
>
{intl.formatMessage(intlMessages.message)}
{showEndMeeting ?
<Button
className={styles.endMeeting}
label={intl.formatMessage(intlMessages.endMeetingLabel)}
onClick={handleEndMeeting}
aria-describedby="modalEndMeetingDesc"
2018-03-20 04:49:41 +08:00
/> : null
}
<div id="modalEndMeetingDesc" hidden>{intl.formatMessage(intlMessages.endMeetingDesc)}</div>
</Modal>
);
2017-09-22 02:50:21 +08:00
LeaveConfirmation.propTypes = propTypes;
2018-04-26 03:34:22 +08:00
export default injectIntl(LeaveConfirmation);