From 127ead34c42cabb65cfd2170555dd53b9abf0be3 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Wed, 12 Jun 2019 17:30:36 +0200 Subject: [PATCH] Restore navigation bar position glitch-soc setting --- .../glitch/features/ui/components/columns_area.js | 6 ++++-- .../flavours/glitch/features/ui/index.js | 15 +-------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/app/javascript/flavours/glitch/features/ui/components/columns_area.js b/app/javascript/flavours/glitch/features/ui/components/columns_area.js index 2e28bbe50e..74434bb7e0 100644 --- a/app/javascript/flavours/glitch/features/ui/components/columns_area.js +++ b/app/javascript/flavours/glitch/features/ui/components/columns_area.js @@ -51,6 +51,7 @@ export default class ColumnsArea extends ImmutablePureComponent { swipeToChangeColumns: PropTypes.bool, singleColumn: PropTypes.bool, children: PropTypes.node, + navbarUnder: PropTypes.bool, }; state = { @@ -156,7 +157,7 @@ export default class ColumnsArea extends ImmutablePureComponent { } render () { - const { columns, children, singleColumn, swipeToChangeColumns, intl } = this.props; + const { columns, children, singleColumn, swipeToChangeColumns, intl, navbarUnder } = this.props; const { shouldAnimate } = this.state; const columnIndex = getIndex(this.context.router.history.location.pathname); @@ -182,8 +183,9 @@ export default class ColumnsArea extends ImmutablePureComponent {
- + {!navbarUnder && } {content} + {navbarUnder && }
diff --git a/app/javascript/flavours/glitch/features/ui/index.js b/app/javascript/flavours/glitch/features/ui/index.js index 46620074c0..787488db41 100644 --- a/app/javascript/flavours/glitch/features/ui/index.js +++ b/app/javascript/flavours/glitch/features/ui/index.js @@ -270,19 +270,6 @@ export default class UI extends React.Component { }; } - shouldComponentUpdate (nextProps) { - if (nextProps.navbarUnder !== this.props.navbarUnder) { - // Avoid expensive update just to toggle a class - this.node.classList.toggle('navbar-under', nextProps.navbarUnder); - - return false; - } - - // Why isn't this working?!? - // return super.shouldComponentUpdate(nextProps, nextState); - return true; - } - componentDidUpdate (prevProps) { if (![this.props.location.pathname, '/'].includes(prevProps.location.pathname)) { this.columnsAreaNode.handleChildrenContentChange(); @@ -477,7 +464,7 @@ export default class UI extends React.Component { return (
- + {redirect}