2016-11-07 23:52:39 +08:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
|
|
|
import { clearModal } from '/imports/ui/components/app/service';
|
2017-02-16 02:36:30 +08:00
|
|
|
import { exitAudio } from '/imports/api/phone'
|
2016-11-07 23:52:39 +08:00
|
|
|
import Modal from '/imports/ui/components/modal/component';
|
|
|
|
|
|
|
|
const intlMessages = defineMessages({
|
|
|
|
title: {
|
2016-11-14 19:57:10 +08:00
|
|
|
id: 'app.breakoutJoinConfirmation.title',
|
2016-11-07 23:52:39 +08:00
|
|
|
defaultMessage: 'Join Breakout Room',
|
|
|
|
},
|
|
|
|
message: {
|
|
|
|
id: 'app.breakoutJoinConfirmation.message',
|
2016-11-14 19:57:10 +08:00
|
|
|
defaultMessage: 'Do you want to join',
|
2016-11-07 23:52:39 +08:00
|
|
|
},
|
|
|
|
confirmLabel: {
|
|
|
|
id: 'app.breakoutJoinConfirmation.confirmLabel',
|
|
|
|
defaultMessage: 'Join',
|
|
|
|
},
|
|
|
|
confirmDesc: {
|
|
|
|
id: 'app.breakoutJoinConfirmation.confirmDesc',
|
|
|
|
defaultMessage: 'Join you to the Breakout Room',
|
|
|
|
},
|
|
|
|
dismissLabel: {
|
|
|
|
id: 'app.breakoutJoinConfirmation.dismissLabel',
|
|
|
|
defaultMessage: 'Cancel',
|
|
|
|
},
|
|
|
|
dismissDesc: {
|
|
|
|
id: 'app.breakoutJoinConfirmation.dismissDesc',
|
|
|
|
defaultMessage: 'Closes and rejects Joining the Breakout Room',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2017-02-16 02:36:30 +08:00
|
|
|
class BreakoutJoinConfirmation extends Component {
|
2016-11-07 23:52:39 +08:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.handleJoinBreakoutConfirmation = this.handleJoinBreakoutConfirmation.bind(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
handleJoinBreakoutConfirmation() {
|
|
|
|
const { breakoutURL } = this.props;
|
|
|
|
|
2017-02-16 02:36:30 +08:00
|
|
|
// leave main room's audio when joining a breakout room
|
|
|
|
exitAudio();
|
|
|
|
|
2016-11-07 23:52:39 +08:00
|
|
|
window.open(breakoutURL);
|
|
|
|
clearModal();
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2016-11-14 19:57:10 +08:00
|
|
|
const { intl, breakoutName } = this.props;
|
2016-11-07 23:52:39 +08:00
|
|
|
return (
|
|
|
|
<Modal
|
|
|
|
title={intl.formatMessage(intlMessages.title)}
|
|
|
|
confirm={{
|
|
|
|
callback: this.handleJoinBreakoutConfirmation,
|
|
|
|
label: intl.formatMessage(intlMessages.confirmLabel),
|
|
|
|
description: intl.formatMessage(intlMessages.confirmDesc),
|
|
|
|
}}
|
|
|
|
dismiss={{
|
|
|
|
label: intl.formatMessage(intlMessages.dismissLabel),
|
|
|
|
description: intl.formatMessage(intlMessages.dismissDesc),
|
|
|
|
}}>
|
2016-11-14 19:57:10 +08:00
|
|
|
{`${intl.formatMessage(intlMessages.message)} ${breakoutName}?`}
|
2016-11-07 23:52:39 +08:00
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-16 02:36:30 +08:00
|
|
|
export default injectIntl(BreakoutJoinConfirmation);
|