From 74a0cc6a119f64ff368945523260408323b364e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sat, 22 Jul 2017 19:51:34 +0200 Subject: [PATCH] Added settings toggle to move the navbar at the bottom in mobile view (#93) --- .../glitch/components/local_settings/page/index.js | 8 ++++++++ app/javascript/glitch/locales/en.json | 1 + app/javascript/glitch/reducers/local_settings.js | 1 + app/javascript/mastodon/features/ui/index.js | 7 +++++-- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/javascript/glitch/components/local_settings/page/index.js b/app/javascript/glitch/components/local_settings/page/index.js index 8635b604f6..cb041c0b8d 100644 --- a/app/javascript/glitch/components/local_settings/page/index.js +++ b/app/javascript/glitch/components/local_settings/page/index.js @@ -53,6 +53,14 @@ export default class LocalSettingsPage extends React.PureComponent { > + + + ), ({ onChange, settings }) => ( diff --git a/app/javascript/glitch/locales/en.json b/app/javascript/glitch/locales/en.json index d202d9c339..21616f556b 100644 --- a/app/javascript/glitch/locales/en.json +++ b/app/javascript/glitch/locales/en.json @@ -26,6 +26,7 @@ "settings.media_fullwidth": "Full-width media previews", "settings.preferences": "User preferences", "settings.wide_view": "Wide view (Desktop mode only)", + "settings.navbar_under": "Navbar at the bottom (Mobile only)", "status.collapse": "Collapse", "status.uncollapse": "Uncollapse", "notification.markForDeletion": "Mark for deletion" diff --git a/app/javascript/glitch/reducers/local_settings.js b/app/javascript/glitch/reducers/local_settings.js index 35a8e065b2..386d59ceb8 100644 --- a/app/javascript/glitch/reducers/local_settings.js +++ b/app/javascript/glitch/reducers/local_settings.js @@ -51,6 +51,7 @@ These are only used if no previously-saved values exist. const initialState = ImmutableMap({ layout : 'auto', stretch : true, + navbar_under : false, collapsed : ImmutableMap({ enabled : true, auto : ImmutableMap({ diff --git a/app/javascript/mastodon/features/ui/index.js b/app/javascript/mastodon/features/ui/index.js index 1edc7504c8..bda32781c4 100644 --- a/app/javascript/mastodon/features/ui/index.js +++ b/app/javascript/mastodon/features/ui/index.js @@ -45,6 +45,7 @@ const mapStateToProps = state => ({ systemFontUi: state.getIn(['meta', 'system_font_ui']), layout: state.getIn(['local_settings', 'layout']), isWide: state.getIn(['local_settings', 'stretch']), + navbarUnder: state.getIn(['local_settings', 'navbar_under']), isComposing: state.getIn(['compose', 'is_composing']), }); @@ -57,6 +58,7 @@ export default class UI extends React.PureComponent { layout: PropTypes.string, isWide: PropTypes.bool, systemFontUi: PropTypes.bool, + navbarUnder: PropTypes.bool, isComposing: PropTypes.bool, }; @@ -167,7 +169,7 @@ export default class UI extends React.PureComponent { render () { const { width, draggingOver } = this.state; - const { children, layout, isWide } = this.props; + const { children, layout, isWide, navbarUnder } = this.props; const columnsClass = layout => { switch (layout) { @@ -187,7 +189,7 @@ export default class UI extends React.PureComponent { return (
- + {navbarUnder ? null : ()} @@ -218,6 +220,7 @@ export default class UI extends React.PureComponent { + {navbarUnder ? () : null}