diff --git a/components/channel_layout/center_channel/index.js b/components/channel_layout/center_channel/index.js
index 4ddebba0b788..922dda0182dc 100644
--- a/components/channel_layout/center_channel/index.js
+++ b/components/channel_layout/center_channel/index.js
@@ -6,6 +6,9 @@ import {getTeamByName} from 'mattermost-redux/selectors/entities/teams';
import Constants from 'utils/constants';
import {getGlobalItem} from 'selectors/storage';
+import {getIsRhsOpen, getIsRhsMenuOpen} from 'selectors/rhs';
+import {getIsLhsOpen} from 'selectors/lhs';
+import {getIsWebrtcOpen} from 'selectors/webrtc';
import CenterChannel from './center_channel';
@@ -20,6 +23,10 @@ const getLastChannelPath = (state, teamName) => {
const mapStateToProps = (state, ownProps) => ({
lastChannelPath: `${ownProps.match.url}/channels/${getLastChannelPath(state, ownProps.match.params.team)}`,
+ lhsOpen: getIsLhsOpen(state),
+ rhsOpen: getIsRhsOpen(state),
+ rhsMenuOpen: getIsRhsMenuOpen(state),
+ webRtcOpen: getIsWebrtcOpen(state),
});
export default connect(mapStateToProps)(CenterChannel);
diff --git a/components/channel_layout/channel_controller.jsx b/components/channel_layout/channel_controller.jsx
index f2badeced736..63b93cbbd886 100644
--- a/components/channel_layout/channel_controller.jsx
+++ b/components/channel_layout/channel_controller.jsx
@@ -22,8 +22,8 @@ import SidebarRightMenu from 'components/sidebar_right_menu';
import TeamSettingsModal from 'components/team_settings_modal.jsx';
import ImportThemeModal from 'components/user_settings/import_theme_modal.jsx';
import UserSettingsModal from 'components/user_settings/modal';
-import WebrtcNotification from 'components/webrtc/webrtc_notification.jsx';
-import WebrtcSidebar from 'components/webrtc/webrtc_sidebar.jsx';
+import WebrtcNotification from 'components/webrtc/notification';
+import WebrtcSidebar from 'components/webrtc/sidebar';
import ModalController from 'components/modal_controller';
import TeamSidebar from 'components/team_sidebar';
import Sidebar from 'components/sidebar';
diff --git a/components/create_post/create_post.jsx b/components/create_post/create_post.jsx
index 5ee4a8ea2887..4ff4603564cb 100644
--- a/components/create_post/create_post.jsx
+++ b/components/create_post/create_post.jsx
@@ -23,7 +23,7 @@ import MsgTyping from 'components/msg_typing';
import PostDeletedModal from 'components/post_deleted_modal.jsx';
import EmojiIcon from 'components/svg/emoji_icon';
import Textbox from 'components/textbox.jsx';
-import TutorialTip from 'components/tutorial/tutorial_tip.jsx';
+import TutorialTip from 'components/tutorial/tutorial_tip';
const KeyCodes = Constants.KeyCodes;
diff --git a/components/navbar/index.js b/components/navbar/index.js
index 19d2c9a77478..1d2b313a0fa4 100644
--- a/components/navbar/index.js
+++ b/components/navbar/index.js
@@ -5,7 +5,14 @@ import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {getConfig} from 'mattermost-redux/selectors/entities/general';
-import {closeRightHandSide, updateRhsState, showPinnedPosts} from 'actions/views/rhs';
+import {
+ closeRightHandSide as closeRhs,
+ updateRhsState,
+ showPinnedPosts,
+ toggleMenu as toggleRhsMenu,
+ closeMenu as closeRhsMenu,
+} from 'actions/views/rhs';
+import {toggle as toggleLhs, close as closeLhs} from 'actions/views/lhs';
import {getRhsState} from 'selectors/rhs';
import {RHSStates} from 'utils/constants.jsx';
@@ -26,9 +33,13 @@ function mapStateToProps(state) {
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
- closeRightHandSide,
updateRhsState,
showPinnedPosts,
+ toggleLhs,
+ closeLhs,
+ closeRhs,
+ toggleRhsMenu,
+ closeRhsMenu,
}, dispatch),
};
}
diff --git a/components/navbar/navbar.jsx b/components/navbar/navbar.jsx
index 527cd63b7b23..49c9be405389 100644
--- a/components/navbar/navbar.jsx
+++ b/components/navbar/navbar.jsx
@@ -45,9 +45,13 @@ export default class Navbar extends React.Component {
isPinnedPosts: PropTypes.bool,
enableWebrtc: PropTypes.bool.isRequired,
actions: PropTypes.shape({
- closeRightHandSide: PropTypes.func,
updateRhsState: PropTypes.func,
showPinnedPosts: PropTypes.func,
+ toggleLhs: PropTypes.func.isRequired,
+ closeLhs: PropTypes.func.isRequired,
+ closeRhs: PropTypes.func.isRequired,
+ toggleRhsMenu: PropTypes.func.isRequired,
+ closeRhsMenu: PropTypes.func.isRequired,
}),
};
@@ -137,27 +141,22 @@ export default class Navbar extends React.Component {
hideSidebars = (e) => {
var windowWidth = $(window).outerWidth();
if (windowWidth <= 768) {
- this.props.actions.closeRightHandSide();
+ this.props.actions.closeRhs();
if (e.target.className !== 'navbar-toggle' && e.target.className !== 'icon-bar') {
- $('.app__body .inner-wrap').removeClass('move--right move--left move--left-small');
- $('.app__body .sidebar--left').removeClass('move--right');
- $('.multi-teams .team-sidebar').removeClass('move--right');
- $('.app__body .sidebar--right').removeClass('move--left');
- $('.app__body .sidebar--menu').removeClass('move--left');
+ this.props.actions.closeLhs();
+ this.props.actions.closeRhs();
+ this.props.actions.closeRhsMenu();
}
}
}
toggleLeftSidebar = () => {
- $('.app__body .inner-wrap').toggleClass('move--right');
- $('.app__body .sidebar--left').toggleClass('move--right');
- $('.multi-teams .team-sidebar').toggleClass('move--right');
+ this.props.actions.toggleLhs();
}
toggleRightSidebar = () => {
- $('.app__body .inner-wrap').toggleClass('move--left-small');
- $('.app__body .sidebar--menu').toggleClass('move--left');
+ this.props.actions.toggleRhsMenu();
}
showSearch = () => {
diff --git a/components/permalink_view/permalink_view.jsx b/components/permalink_view/permalink_view.jsx
index b2c8fa06cdee..7c22495187b6 100644
--- a/components/permalink_view/permalink_view.jsx
+++ b/components/permalink_view/permalink_view.jsx
@@ -42,7 +42,9 @@ export default class PermalinkView extends React.PureComponent {
}
componentWillReceiveProps(nextProps) {
- this.doPermalinkEvent(nextProps);
+ if (this.props.match.params.postid !== nextProps.match.params.postid) {
+ this.doPermalinkEvent(nextProps);
+ }
}
doPermalinkEvent = async (props) => {
diff --git a/components/search_bar/index.jsx b/components/search_bar/index.jsx
index ebd8eb701835..ecdbb985cdb7 100644
--- a/components/search_bar/index.jsx
+++ b/components/search_bar/index.jsx
@@ -11,6 +11,7 @@ import {
showFlaggedPosts,
closeRightHandSide,
} from 'actions/views/rhs';
+import {closeWebrtc} from 'actions/views/webrtc';
import {getRhsState, getSearchTerms, getIsSearchingTerm} from 'selectors/rhs';
import {RHSStates} from 'utils/constants.jsx';
@@ -35,6 +36,7 @@ function mapDispatchToProps(dispatch) {
showMentions,
showFlaggedPosts,
closeRightHandSide,
+ closeWebrtc,
}, dispatch),
};
}
diff --git a/components/search_bar/search_bar.jsx b/components/search_bar/search_bar.jsx
index eea2c674bf9c..ce7139b93759 100644
--- a/components/search_bar/search_bar.jsx
+++ b/components/search_bar/search_bar.jsx
@@ -31,6 +31,7 @@ export default class SearchBar extends React.Component {
showMentions: PropTypes.func,
showFlaggedPosts: PropTypes.func,
closeRightHandSide: PropTypes.func,
+ closeWebrtc: PropTypes.func,
}),
};
@@ -64,15 +65,7 @@ export default class SearchBar extends React.Component {
}
handleClose = () => {
- if (Utils.isMobile()) {
- setTimeout(() => {
- document.querySelector('.app__body .sidebar--menu').classList.add('visible');
- document.querySelector('#sidebar-webrtc').classList.remove('webrtc--show');
- document.querySelector('#inner-wrap-webrtc').classList.remove('webrtc--show');
- document.querySelector('#inner-wrap-webrtc').classList.remove('move--left');
- });
- }
-
+ this.props.actions.closeWebrtc();
this.props.actions.closeRightHandSide();
}
diff --git a/components/sidebar/header/sidebar_header.jsx b/components/sidebar/header/sidebar_header.jsx
index 318505f39ffa..13a91375abdb 100644
--- a/components/sidebar/header/sidebar_header.jsx
+++ b/components/sidebar/header/sidebar_header.jsx
@@ -9,7 +9,7 @@ import PreferenceStore from 'stores/preference_store.jsx';
import {Constants, Preferences, TutorialSteps} from 'utils/constants.jsx';
import * as Utils from 'utils/utils.jsx';
import StatusDropdown from 'components/status_dropdown/index.jsx';
-import {createMenuTip} from 'components/tutorial/tutorial_tip.jsx';
+import MenuTutorialTip from 'components/tutorial/menu_tutorial_tip';
import SidebarHeaderDropdown from './dropdown';
@@ -89,7 +89,12 @@ export default class SidebarHeader extends React.Component {
let tutorialTip = null;
if (this.state.showTutorialTip) {
- tutorialTip = createMenuTip(this.showDropdown);
+ tutorialTip = (
+
+ );
}
let teamNameWithToolTip = null;
diff --git a/components/sidebar/index.js b/components/sidebar/index.js
index 98142b7530d8..f73a097f2ba6 100644
--- a/components/sidebar/index.js
+++ b/components/sidebar/index.js
@@ -2,6 +2,7 @@
// See License.txt for license information.
import {connect} from 'react-redux';
+import {bindActionCreators} from 'redux';
import {Preferences} from 'mattermost-redux/constants/index';
import {
@@ -25,6 +26,8 @@ import {getCurrentTeam, isCurrentUserCurrentTeamAdmin} from 'mattermost-redux/se
import {goToChannelById} from 'actions/channel_actions.jsx';
import {showCreateOption} from 'utils/channel_utils.jsx';
import {GroupUnreadChannels, Constants} from 'utils/constants.jsx';
+import {close} from 'actions/views/lhs';
+import {getIsLhsOpen} from 'selectors/lhs';
import Sidebar from './sidebar.jsx';
@@ -65,6 +68,7 @@ function mapStateToProps(state) {
return {
config,
+ isOpen: getIsLhsOpen(state),
showUnreadSection,
publicChannelIds,
privateChannelIds,
@@ -81,11 +85,12 @@ function mapStateToProps(state) {
};
}
-function mapDispatchToProps() {
+function mapDispatchToProps(dispatch) {
return {
- actions: {
+ actions: bindActionCreators({
goToChannelById,
- },
+ close,
+ }, dispatch),
};
}
diff --git a/components/sidebar/sidebar.jsx b/components/sidebar/sidebar.jsx
index f84868e2801c..78f5f8489a39 100644
--- a/components/sidebar/sidebar.jsx
+++ b/components/sidebar/sidebar.jsx
@@ -7,6 +7,7 @@ import {OverlayTrigger, Tooltip} from 'react-bootstrap';
import ReactDOM from 'react-dom';
import {FormattedMessage} from 'react-intl';
import {PropTypes} from 'prop-types';
+import classNames from 'classnames';
import {browserHistory} from 'utils/browser_history';
import {trackEvent} from 'actions/diagnostics_actions.jsx';
@@ -33,6 +34,8 @@ export default class Sidebar extends React.PureComponent {
*/
config: PropTypes.object.isRequired,
+ isOpen: PropTypes.bool.isRequired,
+
/**
* List of public channels (ids)
*/
@@ -100,6 +103,7 @@ export default class Sidebar extends React.PureComponent {
actions: PropTypes.shape({
goToChannelById: PropTypes.func.isRequired,
+ close: PropTypes.func.isRequired,
}).isRequired,
};
@@ -162,9 +166,7 @@ export default class Sidebar extends React.PureComponent {
if (this.closedDirectChannel) {
this.closedDirectChannel = false;
} else {
- $('.app__body .inner-wrap').removeClass('move--right');
- $('.app__body .sidebar--left').removeClass('move--right');
- $('.multi-teams .team-sidebar').removeClass('move--right');
+ this.props.actions.close();
}
}
@@ -657,7 +659,7 @@ export default class Sidebar extends React.PureComponent {
return (