2017-09-22 02:50:21 +08:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2017-03-17 22:23:00 +08:00
|
|
|
import { withRouter } from 'react-router';
|
2017-09-22 22:33:12 +08:00
|
|
|
import { defineMessages, injectIntl, intlShape } 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';
|
2017-09-22 02:50:21 +08:00
|
|
|
import styles from './styles';
|
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
handleEndMeeting: PropTypes.func.isRequired,
|
2017-09-22 22:33:12 +08:00
|
|
|
intl: PropTypes.shape(intlShape).isRequired,
|
2017-09-22 02:50:21 +08:00
|
|
|
router: PropTypes.object.isRequired,
|
|
|
|
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',
|
|
|
|
},
|
|
|
|
endMeetingDesc: {
|
|
|
|
id: 'app.leaveConfirmation.endMeetingDesc',
|
|
|
|
description: 'adds context to end meeting option',
|
|
|
|
},
|
2016-09-02 00:29:51 +08:00
|
|
|
});
|
|
|
|
|
2017-09-22 02:50:21 +08:00
|
|
|
const LeaveConfirmation = ({
|
|
|
|
intl,
|
|
|
|
router,
|
|
|
|
handleEndMeeting,
|
|
|
|
showEndMeeting,
|
|
|
|
}) => (
|
|
|
|
<Modal
|
|
|
|
title={intl.formatMessage(intlMessages.title)}
|
|
|
|
confirm={{
|
|
|
|
callback: () => router.push('/logout'),
|
|
|
|
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'}
|
|
|
|
/> : 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
|
|
|
|
2017-03-17 22:23:00 +08:00
|
|
|
export default withRouter(injectIntl(LeaveConfirmation));
|