From 7baf15675fbf068b8c455377f917746624b56258 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Fri, 4 Jan 2019 18:53:27 +0100 Subject: [PATCH] Add local setting to disable swipe-to-change-columns --- .../flavours/glitch/features/local_settings/page/index.js | 8 ++++++++ .../glitch/features/ui/components/columns_area.js | 5 +++-- .../features/ui/containers/columns_area_container.js | 1 + app/javascript/flavours/glitch/reducers/local_settings.js | 1 + 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/javascript/flavours/glitch/features/local_settings/page/index.js b/app/javascript/flavours/glitch/features/local_settings/page/index.js index 4477a4e809..16c64ced65 100644 --- a/app/javascript/flavours/glitch/features/local_settings/page/index.js +++ b/app/javascript/flavours/glitch/features/local_settings/page/index.js @@ -95,6 +95,14 @@ export default class LocalSettingsPage extends React.PureComponent { > + + + ), 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 65a63294b5..61f6c0fed1 100644 --- a/app/javascript/flavours/glitch/features/ui/components/columns_area.js +++ b/app/javascript/flavours/glitch/features/ui/components/columns_area.js @@ -46,6 +46,7 @@ export default class ColumnsArea extends ImmutablePureComponent { static propTypes = { intl: PropTypes.object.isRequired, columns: ImmutablePropTypes.list.isRequired, + swipeToChangeColumns: PropTypes.bool, singleColumn: PropTypes.bool, children: PropTypes.node, }; @@ -153,7 +154,7 @@ export default class ColumnsArea extends ImmutablePureComponent { } render () { - const { columns, children, singleColumn, intl } = this.props; + const { columns, children, singleColumn, swipeToChangeColumns, intl } = this.props; const { shouldAnimate } = this.state; const columnIndex = getIndex(this.context.router.history.location.pathname); @@ -163,7 +164,7 @@ export default class ColumnsArea extends ImmutablePureComponent { const floatingActionButton = shouldHideFAB(this.context.router.history.location.pathname) ? null : ; return columnIndex !== -1 ? [ - + {links.map(this.renderView)} , 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 4e26f3017c..ba194a0029 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 @@ -3,6 +3,7 @@ import ColumnsArea from '../components/columns_area'; 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); diff --git a/app/javascript/flavours/glitch/reducers/local_settings.js b/app/javascript/flavours/glitch/reducers/local_settings.js index 15239f28ee..93a4043285 100644 --- a/app/javascript/flavours/glitch/reducers/local_settings.js +++ b/app/javascript/flavours/glitch/reducers/local_settings.js @@ -9,6 +9,7 @@ const initialState = ImmutableMap({ layout : 'auto', stretch : true, navbar_under : false, + swipe_to_change_columns: true, side_arm : 'none', side_arm_reply_mode : 'keep', show_reply_count : false,