bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/audio/audio-menu/component.jsx

59 lines
1.5 KiB
React
Raw Normal View History

import React from 'react';
import { createContainer } from 'meteor/react-meteor-data';
import Button from '/imports/ui/components/button/component';
2017-02-15 00:28:21 +08:00
import { withRouter } from 'react-router';
import { defineMessages, injectIntl } from 'react-intl';
2017-07-24 22:15:46 +08:00
import AudioManager from '/imports/api/2.0/audio/client/manager';
2017-02-15 00:28:21 +08:00
const intlMessages = defineMessages({
joinAudio: {
id: 'app.audio.joinAudio',
description: 'Join audio button label',
2017-02-15 00:28:21 +08:00
},
leaveAudio: {
id: 'app.audio.leaveAudio',
2017-04-10 23:50:03 +08:00
description: 'Leave audio button label',
2017-04-11 22:07:49 +08:00
},
2017-02-15 00:28:21 +08:00
});
2017-02-15 00:28:21 +08:00
class JoinAudioOptions extends React.Component {
render() {
const {
intl,
isInAudio,
isInListenOnly,
2017-03-15 06:34:57 +08:00
handleJoinAudio,
handleCloseAudio,
2017-02-15 00:28:21 +08:00
} = this.props;
if (isInAudio || isInListenOnly) {
2017-06-28 06:41:56 +08:00
if (AudioManager.currentState == AudioManager.callStates.inConference ||
AudioManager.currentState == AudioManager.callStates.inListenOnly) {
return (
<Button
onClick={handleCloseAudio}
label={intl.formatMessage(intlMessages.leaveAudio)}
color={'danger'}
icon={'audio_off'}
size={'lg'}
circle
/>
);
2017-06-28 06:41:56 +08:00
}
}
return (
<Button
2017-03-15 06:34:57 +08:00
onClick={handleJoinAudio}
2017-02-15 00:28:21 +08:00
label={intl.formatMessage(intlMessages.joinAudio)}
color={'primary'}
2017-03-02 09:03:02 +08:00
icon={'audio_on'}
size={'lg'}
2017-06-03 03:25:02 +08:00
circle
/>
);
}
}
2017-02-15 00:28:21 +08:00
export default withRouter(injectIntl(JoinAudioOptions));