diff --git a/actions/global_actions.jsx b/actions/global_actions.jsx index dda4af5726da..91ea2fc45c94 100644 --- a/actions/global_actions.jsx +++ b/actions/global_actions.jsx @@ -24,7 +24,8 @@ import {loadChannelsForCurrentUser} from 'actions/channel_actions.jsx'; import {handleNewPost} from 'actions/post_actions.jsx'; import {stopPeriodicStatusUpdates} from 'actions/status_actions.jsx'; import {loadNewDMIfNeeded, loadNewGMIfNeeded, loadProfilesForSidebar} from 'actions/user_actions.jsx'; -import {closeRightHandSide} from 'actions/views/rhs'; +import {closeRightHandSide, closeMenu as closeRhsMenu} from 'actions/views/rhs'; +import {close as closeLhs} from 'actions/views/lhs'; import * as WebsocketActions from 'actions/websocket_actions.jsx'; import AppDispatcher from 'dispatcher/app_dispatcher.jsx'; import BrowserStore from 'stores/browser_store.jsx'; @@ -472,10 +473,8 @@ export function clientLogout(redirectTo = '/') { export function toggleSideBarRightMenuAction() { dispatch(closeRightHandSide()); - - document.querySelector('.app__body .inner-wrap').classList.remove('move--right', 'move--left', 'move--left-small'); - document.querySelector('.app__body .sidebar--left').classList.remove('move--right'); - document.querySelector('.app__body .sidebar--right').classList.remove('move--left'); + dispatch(closeLhs()); + dispatch(closeRhsMenu()); document.querySelector('.app__body .sidebar--menu').classList.remove('move--left'); } diff --git a/actions/views/lhs.js b/actions/views/lhs.js index d07e5b174924..def81cd5cfe9 100644 --- a/actions/views/lhs.js +++ b/actions/views/lhs.js @@ -1,15 +1,16 @@ +// Copyright (c) 2018-present Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. -import {fetchMyChannelsAndMembers} from 'mattermost-redux/actions/channels'; +import {ActionTypes} from 'utils/constants.jsx'; -import {loadProfilesForSidebar} from 'actions/user_actions.jsx'; -import {loadStatusesForChannelAndSidebar} from 'actions/status_actions.jsx'; -import store from 'stores/redux_store.jsx'; +export const toggle = () => (dispatch) => dispatch({ + type: ActionTypes.TOGGLE_LHS, +}); -const dispatch = store.dispatch; -const getState = store.getState; +export const open = () => (dispatch) => dispatch({ + type: ActionTypes.OPEN_LHS, +}); -export async function initTeamChangeActions(teamId) { - await fetchMyChannelsAndMembers(teamId)(dispatch, getState); - loadStatusesForChannelAndSidebar(); - loadProfilesForSidebar(); -} +export const close = () => (dispatch) => dispatch({ + type: ActionTypes.CLOSE_LHS, +}); diff --git a/actions/views/rhs.js b/actions/views/rhs.js index 34deb460fe5c..f10bc8b5f245 100644 --- a/actions/views/rhs.js +++ b/actions/views/rhs.js @@ -261,3 +261,15 @@ export function closeRightHandSide() { ])); }; } + +export const toggleMenu = () => (dispatch) => dispatch({ + type: ActionTypes.TOGGLE_RHS_MENU, +}); + +export const openMenu = () => (dispatch) => dispatch({ + type: ActionTypes.OPEN_RHS_MENU, +}); + +export const closeMenu = () => (dispatch) => dispatch({ + type: ActionTypes.CLOSE_RHS_MENU, +}); diff --git a/actions/views/webrtc.js b/actions/views/webrtc.js new file mode 100644 index 000000000000..231fb5fd73ed --- /dev/null +++ b/actions/views/webrtc.js @@ -0,0 +1,14 @@ +// Copyright (c) 2018-present Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import {ActionTypes} from 'utils/constants.jsx'; + +export const initWebrtc = (userId, isCaller) => (dispatch) => dispatch({ + type: ActionTypes.INIT_WEBRTC, + userId, + isCaller, +}); + +export const closeWebrtc = () => (dispatch) => dispatch({ + type: ActionTypes.CLOSE_WEBRTC, +}); diff --git a/components/channel_layout/center_channel/center_channel.jsx b/components/channel_layout/center_channel/center_channel.jsx index ce1235ccd356..3cdde5a2e98e 100644 --- a/components/channel_layout/center_channel/center_channel.jsx +++ b/components/channel_layout/center_channel/center_channel.jsx @@ -4,6 +4,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import {Route, Switch, Redirect} from 'react-router-dom'; +import classNames from 'classnames'; import PermalinkView from 'components/permalink_view'; import Navbar from 'components/navbar'; @@ -14,6 +15,10 @@ export default class CenterChannel extends React.PureComponent { match: PropTypes.object.isRequired, location: PropTypes.object.isRequired, lastChannelPath: PropTypes.string.isRequired, + lhsOpen: PropTypes.bool.isRequired, + rhsOpen: PropTypes.bool.isRequired, + rhsMenuOpen: PropTypes.bool.isRequired, + webRtcOpen: PropTypes.bool.isRequired, }; constructor(props) { @@ -34,9 +39,13 @@ export default class CenterChannel extends React.PureComponent { const url = this.props.match.url; return (