From b626b59cbbff8fdd0baf99ce6f0253f1ee96cb9d Mon Sep 17 00:00:00 2001 From: Ashish Kumar Date: Tue, 10 Sep 2019 10:35:55 +0530 Subject: [PATCH] UCHAT-3952-sidebar-resize- bug fix for UI getting distorted when navigating through pinned posts. --- .../channel_layout/center_channel/center_channel.jsx | 7 +++++++ components/channel_view/channel_view.jsx | 2 ++ components/permalink_view/permalink_view.jsx | 7 +++++++ 3 files changed, 16 insertions(+) diff --git a/components/channel_layout/center_channel/center_channel.jsx b/components/channel_layout/center_channel/center_channel.jsx index 889392a769ed..6933313cbda9 100644 --- a/components/channel_layout/center_channel/center_channel.jsx +++ b/components/channel_layout/center_channel/center_channel.jsx @@ -6,6 +6,8 @@ import PropTypes from 'prop-types'; import {Route, Switch, Redirect} from 'react-router-dom'; import classNames from 'classnames'; +import $ from 'jquery'; + import PermalinkView from 'components/permalink_view'; import ChannelHeaderMobile from 'components/channel_header_mobile'; import ChannelIdentifierRouter from 'components/channel_layout/channel_identifier_router'; @@ -31,6 +33,11 @@ export default class CenterChannel extends React.PureComponent { if (this.props.location.pathname !== nextProps.location.pathname && nextProps.location.pathname.includes('/pl/')) { this.setState({returnTo: this.props.location.pathname}); } + this.leftMargin = $('#app-content').css('margin-left'); + } + + componentDidUpdate() { + $('#app-content').css('margin-left', this.leftMargin); } render() { diff --git a/components/channel_view/channel_view.jsx b/components/channel_view/channel_view.jsx index d1552d492734..a875e8c888fa 100644 --- a/components/channel_view/channel_view.jsx +++ b/components/channel_view/channel_view.jsx @@ -72,6 +72,7 @@ export default class ChannelView extends React.PureComponent { if (this.props.match.url !== nextProps.match.url) { this.createDeferredPostView(); } + this.leftMargin = $('#app-content').css('margin-left'); } getChannelView = () => { @@ -105,6 +106,7 @@ export default class ChannelView extends React.PureComponent { this.props.actions.goToLastViewedChannel(); } } + $('#app-content').css('margin-left', this.leftMargin); } render() { diff --git a/components/permalink_view/permalink_view.jsx b/components/permalink_view/permalink_view.jsx index e9fbe84e0548..fdaaed2d2926 100644 --- a/components/permalink_view/permalink_view.jsx +++ b/components/permalink_view/permalink_view.jsx @@ -6,6 +6,8 @@ import PropTypes from 'prop-types'; import {FormattedMessage, intlShape} from 'react-intl'; import {Link} from 'react-router-dom'; +import $ from 'jquery'; + import ChannelHeader from 'components/channel_header'; import PostView from 'components/post_view'; import FormattedMarkdownMessage from 'components/formatted_markdown_message'; @@ -53,6 +55,11 @@ export default class PermalinkView extends React.PureComponent { if (this.props.match.params.postid !== nextProps.match.params.postid) { this.doPermalinkEvent(nextProps); } + this.leftMargin = $('#app-content').css('margin-left'); + } + + componentDidUpdate() { + $('#app-content').css('margin-left', this.leftMargin); } doPermalinkEvent = async (props) => {