From f0df1a13bb95cc6080791dda363e223fb3771e9f Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Wed, 12 Jun 2019 19:38:57 +0200 Subject: Fix navigation panel --- .../glitch/features/ui/components/columns_area.js | 5 +- .../features/ui/components/navigation_panel.js | 57 ++++++++-------------- .../ui/containers/columns_area_container.js | 11 ++++- 3 files changed, 32 insertions(+), 41 deletions(-) (limited to 'app/javascript/flavours') 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 bc59abb60..12aa396fd 100644 --- a/app/javascript/flavours/glitch/features/ui/components/columns_area.js +++ b/app/javascript/flavours/glitch/features/ui/components/columns_area.js @@ -52,6 +52,7 @@ class ColumnsArea extends ImmutablePureComponent { singleColumn: PropTypes.bool, children: PropTypes.node, navbarUnder: PropTypes.bool, + openSettings: PropTypes.func, }; state = { @@ -157,7 +158,7 @@ class ColumnsArea extends ImmutablePureComponent { } render () { - const { columns, children, singleColumn, swipeToChangeColumns, intl, navbarUnder } = this.props; + const { columns, children, singleColumn, swipeToChangeColumns, intl, navbarUnder, openSettings } = this.props; const { shouldAnimate } = this.state; const columnIndex = getIndex(this.context.router.history.location.pathname); @@ -190,7 +191,7 @@ class ColumnsArea extends ImmutablePureComponent {
- +
diff --git a/app/javascript/flavours/glitch/features/ui/components/navigation_panel.js b/app/javascript/flavours/glitch/features/ui/components/navigation_panel.js index ddcd07aaa..de60a7ac3 100644 --- a/app/javascript/flavours/glitch/features/ui/components/navigation_panel.js +++ b/app/javascript/flavours/glitch/features/ui/components/navigation_panel.js @@ -1,50 +1,31 @@ import React from 'react'; -import ImmutablePureComponent from 'react-immutable-pure-component'; import { NavLink, withRouter } from 'react-router-dom'; import { FormattedMessage } from 'react-intl'; import Icon from 'flavours/glitch/components/icon'; import NotificationsCounterIcon from './notifications_counter_icon'; import FollowRequestsNavLink from './follow_requests_nav_link'; import ListPanel from './list_panel'; -import { openModal } from 'flavours/glitch/actions/modal'; -import { connect } from 'react-redux'; -const mapStateToProps = () => {}; +const NavigationPanel = ({ onOpenSettings }) => ( +
+ + + + + + + + -const mapDispatchToProps = dispatch => ({ - openSettings (e) { - e.preventDefault(); - e.stopPropagation(); - dispatch(openModal('SETTINGS', {})); - }, -}); + -export default @connect(mapStateToProps, mapDispatchToProps) -@withRouter -class NavigationPanel extends ImmutablePureComponent { - render() { - const { openSettings } = this.props; +
- return ( -
- - - - - - - - + + + + +
+); - - -
- - - - - -
- ); - }; -}; +export default withRouter(NavigationPanel); diff --git a/app/javascript/flavours/glitch/features/ui/containers/columns_area_container.js b/app/javascript/flavours/glitch/features/ui/containers/columns_area_container.js index ba194a002..b69842cd6 100644 --- a/app/javascript/flavours/glitch/features/ui/containers/columns_area_container.js +++ b/app/javascript/flavours/glitch/features/ui/containers/columns_area_container.js @@ -1,9 +1,18 @@ import { connect } from 'react-redux'; import ColumnsArea from '../components/columns_area'; +import { openModal } from 'flavours/glitch/actions/modal'; const mapStateToProps = state => ({ columns: state.getIn(['settings', 'columns']), swipeToChangeColumns: state.getIn(['local_settings', 'swipe_to_change_columns']), }); -export default connect(mapStateToProps, null, null, { forwardRef: true })(ColumnsArea); +const mapDispatchToProps = dispatch => ({ + openSettings (e) { + e.preventDefault(); + e.stopPropagation(); + dispatch(openModal('SETTINGS', {})); + }, +}); + +export default connect(mapStateToProps, mapDispatchToProps, null, { forwardRef: true })(ColumnsArea); -- cgit