Merge pull request #3234 from oswaldoacauan/userlist-toggle

[HTML5] Fix user-list toggle
This commit is contained in:
Anton Georgiev 2016-07-22 15:22:26 -04:00 committed by GitHub
commit 6d8f40fd0e
3 changed files with 23 additions and 16 deletions

View File

@ -1,7 +1,8 @@
import React, { Component, PropTypes } from 'react'; import React, { Component, PropTypes, cloneElement } from 'react';
import { createContainer } from 'meteor/react-meteor-data'; import { createContainer } from 'meteor/react-meteor-data';
import App from './component'; import App from './component';
import { subscribeForData, pollExists } from './service'; import { subscribeForData, pollExists } from './service';
import NavBarContainer from '../nav-bar/container'; import NavBarContainer from '../nav-bar/container';
import ActionsBarContainer from '../actions-bar/container'; import ActionsBarContainer from '../actions-bar/container';
import MediaContainer from '../media/container'; import MediaContainer from '../media/container';
@ -20,8 +21,11 @@ class AppContainer extends Component {
} }
render() { render() {
// inject location on the navbar container
let navbarWithLocation = cloneElement(this.props.navbar, { location: this.props.location });
return ( return (
<App {...this.props}> <App {...this.props} navbar={navbarWithLocation}>
{this.props.children} {this.props.children}
</App> </App>
); );

View File

@ -1,6 +1,5 @@
import React, { Component, PropTypes } from 'react'; import React, { Component, PropTypes } from 'react';
import styles from './styles.scss'; import styles from './styles.scss';
import { withRouter } from 'react-router';
import Button from '../button/component'; import Button from '../button/component';
import RecordButton from './recordbutton/component'; import RecordButton from './recordbutton/component';
@ -24,11 +23,7 @@ class NavBar extends Component {
} }
handleToggleUserList() { handleToggleUserList() {
/* this.props.toggleUserList();
TODO: Find out how to get the current route here
so we can change the click behavior
*/
this.props.router.push('/users');
} }
render() { render() {
@ -66,4 +61,4 @@ class NavBar extends Component {
NavBar.propTypes = propTypes; NavBar.propTypes = propTypes;
NavBar.defaultProps = defaultProps; NavBar.defaultProps = defaultProps;
export default withRouter(NavBar); export default NavBar;

View File

@ -1,5 +1,7 @@
import React, { Component, PropTypes } from 'react'; import React, { Component, PropTypes } from 'react';
import { createContainer } from 'meteor/react-meteor-data'; import { createContainer } from 'meteor/react-meteor-data';
import { withRouter } from 'react-router';
import Auth from '/imports/ui/services/auth'; import Auth from '/imports/ui/services/auth';
import Meetings from '/imports/api/meetings'; import Meetings from '/imports/api/meetings';
@ -19,7 +21,7 @@ class NavBarContainer extends Component {
} }
} }
export default createContainer(() => { export default withRouter(createContainer(({ location, router }) => {
let meetingTitle; let meetingTitle;
let meetingRecorded; let meetingRecorded;
@ -33,10 +35,16 @@ export default createContainer(() => {
meetingRecorded = meetingObject.currentlyBeingRecorded; meetingRecorded = meetingObject.currentlyBeingRecorded;
} }
let data = { return {
presentationTitle: meetingTitle, presentationTitle: meetingTitle,
hasUnreadMessages: true, hasUnreadMessages: true,
beingRecorded: meetingRecorded, beingRecorded: meetingRecorded,
toggleUserList: () => {
if (location.pathname.indexOf('/users') !== -1) {
router.push('/');
} else {
router.push('/users');
}
},
}; };
return data; }, NavBarContainer));
}, NavBarContainer);