2016-05-06 05:14:39 +08:00
|
|
|
import React from 'react';
|
|
|
|
import Modal from 'react-modal';
|
2016-05-20 21:37:19 +08:00
|
|
|
import Icon from '/imports/ui/components/icon/component';
|
|
|
|
import Button from '/imports/ui/components/button/component';
|
2016-05-20 21:46:30 +08:00
|
|
|
import BaseModal from '../BaseModal';
|
|
|
|
import AudioMenu from './submenus/AudioMenu';
|
|
|
|
import VideoMenu from './submenus/VideoMenu';
|
|
|
|
import ApplicationMenu from './submenus/ApplicationMenu';
|
|
|
|
import UsersMenu from './submenus/UsersMenu';
|
|
|
|
import SessionMenu from './submenus/SessionMenu';
|
2016-05-06 05:14:39 +08:00
|
|
|
import classNames from 'classnames';
|
2016-05-07 01:46:14 +08:00
|
|
|
import ReactDOM from 'react-dom';
|
|
|
|
import styles from './styles';
|
2016-05-06 05:14:39 +08:00
|
|
|
|
|
|
|
export default class SettingsModal extends BaseModal {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
this.submenus = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
componentWillMount() {
|
|
|
|
this.setState({ activeSubmenu: 0 });
|
|
|
|
this.submenus.push({ className: AudioMenu,
|
|
|
|
props: { title: 'Audio', prependIconName: 'ion-', icon: 'ios-mic-outline', }, });
|
|
|
|
this.submenus.push({ className: VideoMenu,
|
|
|
|
props: { title: 'Video', prependIconName: 'ion-', icon: 'ios-videocam-outline', }, });
|
|
|
|
this.submenus.push({ className: ApplicationMenu,
|
|
|
|
props: { title: 'App', prependIconName: 'ion-', icon: 'ios-folder-outline', }, });
|
|
|
|
this.submenus.push({ className: UsersMenu,
|
|
|
|
props: { title: 'Participants', prependIconName: 'ion-', icon: 'person', }, });
|
|
|
|
this.submenus.push({ className: SessionMenu,
|
|
|
|
props: { title: 'Session', prependIconName: 'ion-', icon: 'android-exit', }, });
|
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
ReactDOM.render(
|
2016-05-13 00:10:43 +08:00
|
|
|
<Button componentClass='button' style={{ width: '30px', height: '30px', float: 'right' }}
|
|
|
|
onClick={this.openModal} i_class='icon ion-gear-b' rel='tooltip' title='Settings'>
|
2016-05-06 05:14:39 +08:00
|
|
|
<Icon iconName='icon ion-gear-b' className='mediumFont icon ion-gear-b'/>
|
|
|
|
</Button>, document.getElementById('settingsButtonPlaceHolder'));
|
|
|
|
}
|
|
|
|
|
|
|
|
createMenu() {
|
|
|
|
const curr = this.state.activeSubmenu === undefined ? 0 : this.state.activeSubmenu;
|
|
|
|
|
|
|
|
let props = {
|
|
|
|
title: this.submenus[curr].props.title,
|
|
|
|
prependIconName: this.submenus[curr].props.prependIconName,
|
|
|
|
icon: this.submenus[curr].props.icon,
|
|
|
|
};
|
|
|
|
|
|
|
|
const Submenu = this.submenus[curr].className;
|
|
|
|
return <Submenu {...props}/>;
|
|
|
|
}
|
|
|
|
|
|
|
|
clickSubmenu(i) {
|
|
|
|
this.setState({ activeSubmenu: i });
|
|
|
|
}
|
|
|
|
|
|
|
|
getContent() {
|
|
|
|
return (
|
2016-05-07 01:46:14 +08:00
|
|
|
<div style={{ clear: 'both' }}>
|
|
|
|
<div className={styles.settingsMenuLeft}>
|
2016-05-06 05:14:39 +08:00
|
|
|
<ul style={{ listStyleType: 'none' }}>
|
|
|
|
{this.submenus.map((value, index) => (
|
|
|
|
<li key={index} onClick={this.clickSubmenu.bind(this, index)}
|
2016-05-07 01:46:14 +08:00
|
|
|
className={classNames(styles.settingsSubmenuItem,
|
2016-05-13 00:10:43 +08:00
|
|
|
index == this.state.activeSubmenu ? styles.settingsSubmenuItemActive : null)}>
|
2016-05-06 05:14:39 +08:00
|
|
|
<Icon key={index} prependIconName={value.props.prependIconName}
|
|
|
|
iconName={value.props.icon} title={value.props.title}/>
|
2016-05-07 01:46:14 +08:00
|
|
|
<span>{value.props.title}</span>
|
2016-05-06 05:14:39 +08:00
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
</div>
|
2016-05-07 01:46:14 +08:00
|
|
|
<div className={styles.settingsMenuRight}>{this.createMenu()}</div>
|
2016-05-06 05:14:39 +08:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
2016-05-07 01:46:14 +08:00
|
|
|
|
|
|
|
SettingsModal.defaultProps = { title: 'Settings' };
|