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';
|
2017-12-15 03:35:10 +08:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2017-08-09 06:27:34 +08:00
|
|
|
import Button from '/imports/ui/components/button/component';
|
2017-04-05 22:25:26 +08:00
|
|
|
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,
|
2018-10-13 05:14:28 +08:00
|
|
|
confirmLeaving: PropTypes.func.isRequired,
|
2017-12-15 03:35:10 +08:00
|
|
|
intl: PropTypes.shape({
|
|
|
|
formatMessage: PropTypes.func.isRequired,
|
|
|
|
}).isRequired,
|
2017-09-22 02:50:21 +08:00
|
|
|
showEndMeeting: PropTypes.bool.isRequired,
|
|
|
|
};
|
2016-09-02 00:29:51 +08:00
|
|
|
|
|
|
|
const intlMessages = defineMessages({
|
|
|
|
title: {
|
|
|
|
id: 'app.leaveConfirmation.title',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Leave session modal title',
|
2016-09-02 00:29:51 +08:00
|
|
|
},
|
|
|
|
message: {
|
|
|
|
id: 'app.leaveConfirmation.message',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'message for leaving session',
|
2016-09-02 00:29:51 +08:00
|
|
|
},
|
|
|
|
confirmLabel: {
|
|
|
|
id: 'app.leaveConfirmation.confirmLabel',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Confirmation button label',
|
2016-09-02 00:29:51 +08:00
|
|
|
},
|
|
|
|
confirmDesc: {
|
|
|
|
id: 'app.leaveConfirmation.confirmDesc',
|
2017-04-11 21:52:30 +08:00
|
|
|
description: 'adds context to confim option',
|
2016-09-02 00:29:51 +08:00
|
|
|
},
|
|
|
|
dismissLabel: {
|
|
|
|
id: 'app.leaveConfirmation.dismissLabel',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Dismiss button label',
|
2016-09-02 00:29:51 +08:00
|
|
|
},
|
|
|
|
dismissDesc: {
|
|
|
|
id: 'app.leaveConfirmation.dismissDesc',
|
2017-04-11 21:52:30 +08:00
|
|
|
description: 'adds context to dismiss option',
|
2016-09-02 00:29:51 +08:00
|
|
|
},
|
2017-08-02 00:09:06 +08:00
|
|
|
endMeetingLabel: {
|
|
|
|
id: 'app.leaveConfirmation.endMeetingLabel',
|
|
|
|
description: 'End meeting button label',
|
|
|
|
},
|
2018-03-13 02:08:46 +08:00
|
|
|
endMeetingAriaLabel: {
|
|
|
|
id: 'app.leaveConfirmation.endMeetingAriaLabel',
|
|
|
|
description: 'End meeting button aria label',
|
|
|
|
},
|
2017-08-02 00:09:06 +08:00
|
|
|
endMeetingDesc: {
|
|
|
|
id: 'app.leaveConfirmation.endMeetingDesc',
|
|
|
|
description: 'adds context to end meeting option',
|
|
|
|
},
|
2016-09-02 00:29:51 +08:00
|
|
|
});
|
|
|
|
|
2018-04-26 03:34:22 +08:00
|
|
|
|
2018-03-20 04:49:41 +08:00
|
|
|
const LeaveConfirmation = ({
|
|
|
|
intl,
|
|
|
|
handleEndMeeting,
|
|
|
|
showEndMeeting,
|
2018-10-13 05:14:28 +08:00
|
|
|
confirmLeaving,
|
2018-03-20 04:49:41 +08:00
|
|
|
}) => (
|
|
|
|
<Modal
|
|
|
|
title={intl.formatMessage(intlMessages.title)}
|
|
|
|
confirm={{
|
2018-10-13 05:14:28 +08:00
|
|
|
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}
|
2018-10-06 03:23:16 +08:00
|
|
|
aria-describedby="modalEndMeetingDesc"
|
2018-03-20 04:49:41 +08:00
|
|
|
/> : null
|
|
|
|
}
|
|
|
|
<div id="modalEndMeetingDesc" hidden>{intl.formatMessage(intlMessages.endMeetingDesc)}</div>
|
|
|
|
</Modal>
|
|
|
|
);
|
2017-03-17 22:23:00 +08:00
|
|
|
|
2017-09-22 02:50:21 +08:00
|
|
|
LeaveConfirmation.propTypes = propTypes;
|
2016-09-02 00:29:51 +08:00
|
|
|
|
2018-04-26 03:34:22 +08:00
|
|
|
export default injectIntl(LeaveConfirmation);
|