From 34fedc8e466cff2047a1453267feeda768d064cd Mon Sep 17 00:00:00 2001 From: Oswaldo Acauan Date: Thu, 21 Jul 2016 14:24:50 +0000 Subject: [PATCH] Fix user-list toggle --- .../imports/ui/components/app/container.jsx | 14 +++++++++----- .../imports/ui/components/nav-bar/component.jsx | 9 ++------- .../imports/ui/components/nav-bar/container.jsx | 16 ++++++++++++---- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/app/container.jsx b/bigbluebutton-html5/imports/ui/components/app/container.jsx index 9029aad162..2c27122790 100755 --- a/bigbluebutton-html5/imports/ui/components/app/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/app/container.jsx @@ -1,16 +1,17 @@ -import React, { Component, PropTypes } from 'react'; +import React, { Component, PropTypes, cloneElement } from 'react'; import { createContainer } from 'meteor/react-meteor-data'; import App from './component'; import { subscribeForData, pollExists } from './service'; + import NavBarContainer from '../nav-bar/container'; import ActionsBarContainer from '../actions-bar/container'; import MediaContainer from '../media/container'; import SettingsModal from '../modals/settings/SettingsModal'; const defaultProps = { - navbar: , - actionsbar: , - media: , + navbar: , + actionsbar: , + media: , settings: , }; @@ -20,8 +21,11 @@ class AppContainer extends Component { } render() { + // inject location on the navbar container + let navbarWithLocation = cloneElement(this.props.navbar, { location: this.props.location }); + return ( - + {this.props.children} ); diff --git a/bigbluebutton-html5/imports/ui/components/nav-bar/component.jsx b/bigbluebutton-html5/imports/ui/components/nav-bar/component.jsx index a021e0d20b..7cc082ca8b 100755 --- a/bigbluebutton-html5/imports/ui/components/nav-bar/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/nav-bar/component.jsx @@ -1,6 +1,5 @@ import React, { Component, PropTypes } from 'react'; import styles from './styles.scss'; -import { withRouter } from 'react-router'; import Button from '../button/component'; import RecordButton from './recordbutton/component'; @@ -24,11 +23,7 @@ class NavBar extends Component { } handleToggleUserList() { - /* - TODO: Find out how to get the current route here - so we can change the click behavior - */ - this.props.router.push('/users'); + this.props.toggleUserList(); } render() { @@ -66,4 +61,4 @@ class NavBar extends Component { NavBar.propTypes = propTypes; NavBar.defaultProps = defaultProps; -export default withRouter(NavBar); +export default NavBar; diff --git a/bigbluebutton-html5/imports/ui/components/nav-bar/container.jsx b/bigbluebutton-html5/imports/ui/components/nav-bar/container.jsx index bd6bf1d2ee..79b9f9a2f2 100755 --- a/bigbluebutton-html5/imports/ui/components/nav-bar/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/nav-bar/container.jsx @@ -1,5 +1,7 @@ import React, { Component, PropTypes } from 'react'; import { createContainer } from 'meteor/react-meteor-data'; +import { withRouter } from 'react-router'; + import Auth from '/imports/ui/services/auth'; 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 meetingRecorded; @@ -33,10 +35,16 @@ export default createContainer(() => { meetingRecorded = meetingObject.currentlyBeingRecorded; } - let data = { + return { presentationTitle: meetingTitle, hasUnreadMessages: true, beingRecorded: meetingRecorded, + toggleUserList: () => { + if (location.pathname.indexOf('/users') !== -1) { + router.push('/'); + } else { + router.push('/users'); + } + }, }; - return data; -}, NavBarContainer); +}, NavBarContainer));