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

55 lines
1.4 KiB
React
Raw Normal View History

import React from 'react';
import ModalBase from '../../modal/base/component';
import styles from './styles.scss';
import JoinAudio from '../join-audio/component';
import AudioSettings from '../audio-settings/component';
2017-05-02 03:52:57 +08:00
export default class AudioModal extends React.Component {
constructor(props) {
super(props);
this.JOIN_AUDIO = 0;
this.AUDIO_SETTINGS = 1;
this.submenus = [];
}
componentWillMount() {
/* activeSubmenu represents the submenu in the submenus array to be displayed to the user,
* initialized to 0
*/
this.setState({ activeSubmenu: 0 });
2017-06-03 03:25:02 +08:00
this.submenus.push({ componentName: JoinAudio });
this.submenus.push({ componentName: AudioSettings });
}
2017-05-02 03:52:57 +08:00
handleSubmenuChange(i) {
this.setState({ activeSubmenu: i });
}
2017-05-02 03:52:57 +08:00
renderSubmenu(key) {
const curr = this.state.activeSubmenu ? 0 : this.state.activeSubmenu;
2017-06-03 03:25:02 +08:00
const props = {
2017-05-02 03:52:57 +08:00
changeMenu: this.handleSubmenuChange.bind(this),
JOIN_AUDIO: this.JOIN_AUDIO,
AUDIO_SETTINGS: this.AUDIO_SETTINGS,
LISTEN_ONLY: this.LISTEN_ONLY,
handleJoinListenOnly: this.props.handleJoinListenOnly,
};
2017-05-02 03:52:57 +08:00
const Submenu = this.submenus[key].componentName;
2017-06-03 03:25:02 +08:00
return <Submenu {...props} />;
}
render() {
return (
2017-05-02 03:52:57 +08:00
<ModalBase overlayClassName={styles.overlay} className={styles.modal}>
<div>
2017-05-02 03:52:57 +08:00
{this.renderSubmenu(this.state.activeSubmenu)}
</div>
</ModalBase>
);
}
2017-06-03 03:25:02 +08:00
}