Restore navigation bar position glitch-soc setting

master
Thibaut Girka 6 years ago committed by ThibG
parent b191861e15
commit 127ead34c4
  1. 6
      app/javascript/flavours/glitch/features/ui/components/columns_area.js
  2. 15
      app/javascript/flavours/glitch/features/ui/index.js

@ -51,6 +51,7 @@ export default class ColumnsArea extends ImmutablePureComponent {
swipeToChangeColumns: PropTypes.bool, swipeToChangeColumns: PropTypes.bool,
singleColumn: PropTypes.bool, singleColumn: PropTypes.bool,
children: PropTypes.node, children: PropTypes.node,
navbarUnder: PropTypes.bool,
}; };
state = { state = {
@ -156,7 +157,7 @@ export default class ColumnsArea extends ImmutablePureComponent {
} }
render () { render () {
const { columns, children, singleColumn, swipeToChangeColumns, intl } = this.props; const { columns, children, singleColumn, swipeToChangeColumns, intl, navbarUnder } = this.props;
const { shouldAnimate } = this.state; const { shouldAnimate } = this.state;
const columnIndex = getIndex(this.context.router.history.location.pathname); const columnIndex = getIndex(this.context.router.history.location.pathname);
@ -182,8 +183,9 @@ export default class ColumnsArea extends ImmutablePureComponent {
</div> </div>
<div className='columns-area__panels__main'> <div className='columns-area__panels__main'>
<TabsBar key='tabs' /> {!navbarUnder && <TabsBar key='tabs' />}
{content} {content}
{navbarUnder && <TabsBar key='tabs' />}
</div> </div>
<div className='columns-area__panels__pane columns-area__panels__pane--start columns-area__panels__pane--navigational'> <div className='columns-area__panels__pane columns-area__panels__pane--start columns-area__panels__pane--navigational'>

@ -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) { componentDidUpdate (prevProps) {
if (![this.props.location.pathname, '/'].includes(prevProps.location.pathname)) { if (![this.props.location.pathname, '/'].includes(prevProps.location.pathname)) {
this.columnsAreaNode.handleChildrenContentChange(); this.columnsAreaNode.handleChildrenContentChange();
@ -477,7 +464,7 @@ export default class UI extends React.Component {
return ( return (
<HotKeys keyMap={keyMap} handlers={handlers} ref={this.setHotkeysRef} attach={window} focused> <HotKeys keyMap={keyMap} handlers={handlers} ref={this.setHotkeysRef} attach={window} focused>
<div className={className} ref={this.setRef} style={{ pointerEvents: dropdownMenuIsOpen ? 'none' : null }}> <div className={className} ref={this.setRef} style={{ pointerEvents: dropdownMenuIsOpen ? 'none' : null }}>
<ColumnsAreaContainer ref={this.setColumnsAreaRef} singleColumn={singleColumn}> <ColumnsAreaContainer ref={this.setColumnsAreaRef} singleColumn={singleColumn} navbarUnder={navbarUnder}>
<WrappedSwitch> <WrappedSwitch>
{redirect} {redirect}
<WrappedRoute path='/getting-started' component={GettingStarted} content={children} /> <WrappedRoute path='/getting-started' component={GettingStarted} content={children} />

Loading…
Cancel
Save