2016-11-16 05:00:28 +08:00
|
|
|
import React from 'react';
|
2017-03-25 00:01:35 +08:00
|
|
|
import styles from '../audio-modal/styles.scss';
|
2016-11-16 05:00:28 +08:00
|
|
|
import Button from '/imports/ui/components/button/component';
|
2017-04-19 03:06:51 +08:00
|
|
|
import { withModalMounter } from '/imports/ui/components/modal/service';
|
2017-04-07 20:44:05 +08:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2016-11-16 05:00:28 +08:00
|
|
|
|
2017-01-12 02:00:31 +08:00
|
|
|
const intlMessages = defineMessages({
|
|
|
|
microphoneLabel: {
|
|
|
|
id: 'app.audioModal.microphoneLabel',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Join mic audio button label',
|
2017-01-12 02:00:31 +08:00
|
|
|
},
|
|
|
|
listenOnlyLabel: {
|
|
|
|
id: 'app.audioModal.listenOnlyLabel',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Join listen only audio button label',
|
2017-01-12 02:00:31 +08:00
|
|
|
},
|
2017-02-17 06:14:10 +08:00
|
|
|
closeLabel: {
|
|
|
|
id: 'app.audioModal.closeLabel',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'close audio modal button label',
|
2017-04-07 20:44:05 +08:00
|
|
|
},
|
|
|
|
audioChoiceLabel: {
|
|
|
|
id: 'app.audioModal.audioChoiceLabel',
|
2017-04-11 21:52:30 +08:00
|
|
|
description: 'Join audio modal title',
|
2017-04-19 03:06:51 +08:00
|
|
|
},
|
2017-01-12 02:00:31 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
class JoinAudio extends React.Component {
|
2016-11-16 05:00:28 +08:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.handleClose = this.handleClose.bind(this);
|
|
|
|
this.openAudio = this.openAudio.bind(this);
|
|
|
|
this.openListen = this.openListen.bind(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
handleClose() {
|
2017-04-19 03:06:51 +08:00
|
|
|
/* TODO: Refactor this to the outer component (audio-modal/container) */
|
|
|
|
this.props.mountModal(null);
|
2016-11-16 05:00:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
openAudio() {
|
|
|
|
this.props.changeMenu(this.props.AUDIO_SETTINGS);
|
|
|
|
}
|
|
|
|
|
|
|
|
openListen() {
|
2016-12-23 01:47:12 +08:00
|
|
|
this.handleClose();
|
2016-12-23 23:18:44 +08:00
|
|
|
this.props.handleJoinListenOnly();
|
2016-11-16 05:00:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2017-01-12 02:00:31 +08:00
|
|
|
const { intl } = this.props;
|
2016-11-16 05:00:28 +08:00
|
|
|
return (
|
|
|
|
<div>
|
2017-07-11 23:15:19 +08:00
|
|
|
<div className={styles.closeBtnWrapper}>
|
2017-06-03 03:25:02 +08:00
|
|
|
<Button
|
|
|
|
className={styles.closeBtn}
|
2017-02-17 06:14:10 +08:00
|
|
|
label={intl.formatMessage(intlMessages.closeLabel)}
|
2016-11-16 05:00:28 +08:00
|
|
|
icon={'close'}
|
|
|
|
size={'lg'}
|
2017-06-03 03:25:02 +08:00
|
|
|
hideLabel
|
2016-11-16 05:00:28 +08:00
|
|
|
onClick={this.handleClose}
|
|
|
|
/>
|
2017-03-23 04:10:49 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className={styles.title}>
|
2017-04-07 20:44:05 +08:00
|
|
|
{intl.formatMessage(intlMessages.audioChoiceLabel)}
|
2016-11-16 05:00:28 +08:00
|
|
|
</div>
|
|
|
|
<div className={styles.center}>
|
2017-06-03 03:25:02 +08:00
|
|
|
<Button
|
|
|
|
className={styles.audioBtn}
|
2017-01-12 02:00:31 +08:00
|
|
|
label={intl.formatMessage(intlMessages.microphoneLabel)}
|
2017-03-02 09:03:02 +08:00
|
|
|
icon={'unmute'}
|
2017-06-03 03:25:02 +08:00
|
|
|
circle
|
2016-11-16 05:00:28 +08:00
|
|
|
size={'jumbo'}
|
|
|
|
onClick={this.openAudio}
|
|
|
|
/>
|
2017-03-23 04:10:49 +08:00
|
|
|
|
2017-06-03 03:25:02 +08:00
|
|
|
<span className={styles.verticalLine} />
|
|
|
|
<Button
|
|
|
|
className={styles.audioBtn}
|
2017-01-12 02:00:31 +08:00
|
|
|
label={intl.formatMessage(intlMessages.listenOnlyLabel)}
|
2016-11-16 05:00:28 +08:00
|
|
|
icon={'listen'}
|
2017-06-03 03:25:02 +08:00
|
|
|
circle
|
2016-11-16 05:00:28 +08:00
|
|
|
size={'jumbo'}
|
|
|
|
onClick={this.openListen}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2017-06-03 03:25:02 +08:00
|
|
|
}
|
2017-01-12 02:00:31 +08:00
|
|
|
|
2017-04-19 03:06:51 +08:00
|
|
|
export default withModalMounter(injectIntl(JoinAudio));
|