2016-04-29 03:02:51 +08:00
|
|
|
import React, { Component, PropTypes } from 'react';
|
|
|
|
import { createContainer } from 'meteor/react-meteor-data';
|
|
|
|
|
2016-05-20 21:37:19 +08:00
|
|
|
import App from './component';
|
|
|
|
import { pollExists } from './service';
|
|
|
|
|
2016-05-20 21:44:27 +08:00
|
|
|
import NavBarContainer from '../nav-bar/container';
|
2016-05-20 21:37:19 +08:00
|
|
|
import ActionsBarContainer from '../actions-bar/container';
|
2016-05-20 21:44:27 +08:00
|
|
|
import MediaContainer from '../media/container';
|
2016-05-20 21:37:19 +08:00
|
|
|
import PollingContainer from '../polling/container';
|
|
|
|
import SettingsModal from '../modals/settings/SettingsModal';
|
2016-04-29 03:02:51 +08:00
|
|
|
|
|
|
|
const defaultProps = {
|
2016-05-04 22:48:53 +08:00
|
|
|
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);
|