2016-11-07 23:52:39 +08:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2017-05-03 01:18:01 +08:00
|
|
|
import { withModalMounter } from '/imports/ui/components/modal/service';
|
2017-04-05 22:25:26 +08:00
|
|
|
import Modal from '/imports/ui/components/modal/fullscreen/component';
|
2017-10-06 20:50:01 +08:00
|
|
|
import AudioService from '../audio/service';
|
2016-11-07 23:52:39 +08:00
|
|
|
|
|
|
|
const intlMessages = defineMessages({
|
|
|
|
title: {
|
2016-11-14 19:57:10 +08:00
|
|
|
id: 'app.breakoutJoinConfirmation.title',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Join breakout room title',
|
2016-11-07 23:52:39 +08:00
|
|
|
},
|
|
|
|
message: {
|
|
|
|
id: 'app.breakoutJoinConfirmation.message',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Join breakout confim message',
|
2016-11-07 23:52:39 +08:00
|
|
|
},
|
|
|
|
confirmLabel: {
|
|
|
|
id: 'app.breakoutJoinConfirmation.confirmLabel',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Join confirmation button label',
|
2016-11-07 23:52:39 +08:00
|
|
|
},
|
|
|
|
confirmDesc: {
|
|
|
|
id: 'app.breakoutJoinConfirmation.confirmDesc',
|
2017-04-11 21:52:30 +08:00
|
|
|
description: 'adds context to confirm option',
|
2016-11-07 23:52:39 +08:00
|
|
|
},
|
|
|
|
dismissLabel: {
|
|
|
|
id: 'app.breakoutJoinConfirmation.dismissLabel',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Cancel button label',
|
2016-11-07 23:52:39 +08:00
|
|
|
},
|
|
|
|
dismissDesc: {
|
|
|
|
id: 'app.breakoutJoinConfirmation.dismissDesc',
|
2017-04-11 21:52:30 +08:00
|
|
|
description: 'adds context to dismiss option',
|
2016-11-07 23:52:39 +08:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
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() {
|
2017-05-03 01:18:01 +08:00
|
|
|
const {
|
|
|
|
breakoutURL,
|
|
|
|
mountModal,
|
|
|
|
} = this.props;
|
2016-11-07 23:52:39 +08:00
|
|
|
|
2017-02-16 02:36:30 +08:00
|
|
|
// leave main room's audio when joining a breakout room
|
2017-05-03 23:06:28 +08:00
|
|
|
AudioService.exitAudio();
|
2017-02-16 02:36:30 +08:00
|
|
|
|
2016-11-07 23:52:39 +08:00
|
|
|
window.open(breakoutURL);
|
2017-05-03 01:18:01 +08:00
|
|
|
mountModal(null);
|
2016-11-07 23:52:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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),
|
2017-06-03 03:25:02 +08:00
|
|
|
}}
|
|
|
|
>
|
2016-11-14 19:57:10 +08:00
|
|
|
{`${intl.formatMessage(intlMessages.message)} ${breakoutName}?`}
|
2016-11-07 23:52:39 +08:00
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
}
|
2017-06-03 03:25:02 +08:00
|
|
|
}
|
2016-11-07 23:52:39 +08:00
|
|
|
|
2017-05-03 01:18:01 +08:00
|
|
|
export default withModalMounter(injectIntl(BreakoutJoinConfirmation));
|