bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/app/container.jsx

53 lines
1.3 KiB
React
Raw Normal View History

2016-04-29 03:02:51 +08:00
import React, { Component, PropTypes } from 'react';
import { createContainer } from 'meteor/react-meteor-data';
import App from './component';
import { pollExists } from './service';
import NavBarContainer from '../nav-bar/container';
import ActionsBarContainer from '../actions-bar/container';
import MediaContainer from '../media/container';
import PollingContainer from '../polling/container';
import SettingsModal from '../modals/settings/SettingsModal';
2016-04-29 03:02:51 +08:00
const defaultProps = {
navbar: <NavBarContainer/>,
actionsbar: <ActionsBarContainer/>,
2016-05-03 06:42:54 +08:00
media: <MediaContainer/>,
2016-05-13 00:10:43 +08:00
settings: <SettingsModal />,
2016-04-29 03:02:51 +08:00
};
class AppContainer extends Component {
constructor(props) {
super(props);
2016-05-06 23:34:00 +08:00
this.state = {
2016-05-07 03:12:28 +08:00
meetingID: localStorage.getItem('meetingID'),
userID: localStorage.getItem('userID'),
authToken: localStorage.getItem('authToken'),
2016-05-06 23:34:00 +08:00
};
2016-04-29 03:02:51 +08:00
}
render() {
return (
<App {...this.props}>
{this.props.children}
</App>
);
}
}
AppContainer.defaultProps = defaultProps;
2016-05-06 02:50:18 +08:00
const actionControlsToShow = () => {
2016-05-12 23:43:09 +08:00
if (pollExists()) {
2016-05-06 02:50:18 +08:00
return <PollingContainer />;
} else {
return <ActionsBarContainer />;
}
};
2016-04-29 03:02:51 +08:00
export default createContainer(() => {
2016-05-06 02:50:18 +08:00
const data = { actionsbar: actionControlsToShow() };
return data;
2016-04-29 03:02:51 +08:00
}, AppContainer);