diff options
author | 2020-02-26 17:32:05 +0100 | |
---|---|---|
committer | 2020-02-26 17:32:05 +0100 | |
commit | 644878643de84e0566294b57ca40fc70d11437c4 (patch) | |
tree | 284746227df93d54595c833431e625daf8e3c7ea | |
parent | Implement user.css and user.js (#401) (diff) | |
parent | Fix merge errors (diff) | |
download | ferdium-app-644878643de84e0566294b57ca40fc70d11437c4.tar.gz ferdium-app-644878643de84e0566294b57ca40fc70d11437c4.tar.zst ferdium-app-644878643de84e0566294b57ca40fc70d11437c4.zip |
#270 Add more navigation bar behaviour settings
-rw-r--r-- | src/components/services/content/ServiceView.js | 6 | ||||
-rw-r--r-- | src/components/settings/settings/EditSettingsForm.js | 2 | ||||
-rw-r--r-- | src/config.js | 7 | ||||
-rw-r--r-- | src/containers/settings/EditSettingsScreen.js | 24 | ||||
-rw-r--r-- | src/i18n/locales/defaultMessages.json | 6 | ||||
-rw-r--r-- | src/i18n/locales/en-US.json | 2 | ||||
-rw-r--r-- | src/i18n/messages/src/containers/settings/EditSettingsScreen.json | 6 | ||||
-rw-r--r-- | src/stores/SettingsStore.js | 20 |
8 files changed, 54 insertions, 19 deletions
diff --git a/src/components/services/content/ServiceView.js b/src/components/services/content/ServiceView.js index 860863d26..f6832038a 100644 --- a/src/components/services/content/ServiceView.js +++ b/src/components/services/content/ServiceView.js | |||
@@ -135,9 +135,11 @@ export default @inject('stores', 'actions') @observer class ServiceView extends | |||
135 | } = this.props; | 135 | } = this.props; |
136 | 136 | ||
137 | const { | 137 | const { |
138 | showServiceNavigationBar, | 138 | navigationBarBehaviour, |
139 | } = stores.settings.app; | 139 | } = stores.settings.app; |
140 | 140 | ||
141 | const showNavBar = navigationBarBehaviour === 'always' || (navigationBarBehaviour === 'custom' && service.recipe.id === CUSTOM_WEBSITE_ID); | ||
142 | |||
141 | const webviewClasses = classnames({ | 143 | const webviewClasses = classnames({ |
142 | services__webview: true, | 144 | services__webview: true, |
143 | 'services__webview-wrapper': true, | 145 | 'services__webview-wrapper': true, |
@@ -193,7 +195,7 @@ export default @inject('stores', 'actions') @observer class ServiceView extends | |||
193 | <> | 195 | <> |
194 | {!service.isHibernating ? ( | 196 | {!service.isHibernating ? ( |
195 | <> | 197 | <> |
196 | {(service.recipe.id === CUSTOM_WEBSITE_ID || showServiceNavigationBar) && ( | 198 | {showNavBar && ( |
197 | <WebControlsScreen service={service} /> | 199 | <WebControlsScreen service={service} /> |
198 | )} | 200 | )} |
199 | <ServiceWebview | 201 | <ServiceWebview |
diff --git a/src/components/settings/settings/EditSettingsForm.js b/src/components/settings/settings/EditSettingsForm.js index 432a546d9..f41c7db8e 100644 --- a/src/components/settings/settings/EditSettingsForm.js +++ b/src/components/settings/settings/EditSettingsForm.js | |||
@@ -256,7 +256,7 @@ export default @observer class EditSettingsForm extends Component { | |||
256 | <Toggle field={form.$('minimizeToSystemTray')} /> | 256 | <Toggle field={form.$('minimizeToSystemTray')} /> |
257 | )} | 257 | )} |
258 | <Toggle field={form.$('privateNotifications')} /> | 258 | <Toggle field={form.$('privateNotifications')} /> |
259 | <Toggle field={form.$('showServiceNavigationBar')} /> | 259 | <Select field={form.$('navigationBarBehaviour')} /> |
260 | 260 | ||
261 | <Hr /> | 261 | <Hr /> |
262 | 262 | ||
diff --git a/src/config.js b/src/config.js index 9b77aa9a5..283c20f84 100644 --- a/src/config.js +++ b/src/config.js | |||
@@ -45,6 +45,12 @@ export const HIBERNATION_STRATEGIES = { | |||
45 | 3600: 'Extemely Slow Hibernation (1hour)', | 45 | 3600: 'Extemely Slow Hibernation (1hour)', |
46 | }; | 46 | }; |
47 | 47 | ||
48 | export const NAVIGATION_BAR_BEHAVIOURS = { | ||
49 | custom: 'Show navigation bar on custom websites only', | ||
50 | always: 'Show navigation bar on all services', | ||
51 | never: 'Never show navigation bar', | ||
52 | }; | ||
53 | |||
48 | export const SIDEBAR_WIDTH = { | 54 | export const SIDEBAR_WIDTH = { |
49 | 35: 'Extemely slim sidebar', | 55 | 35: 'Extemely slim sidebar', |
50 | 45: 'Very slim sidebar', | 56 | 45: 'Very slim sidebar', |
@@ -107,6 +113,7 @@ export const DEFAULT_APP_SETTINGS = { | |||
107 | serviceRibbonWidth: 68, | 113 | serviceRibbonWidth: 68, |
108 | iconSize: iconSizeBias, | 114 | iconSize: iconSizeBias, |
109 | sentry: false, | 115 | sentry: false, |
116 | navigationBarBehaviour: 'custom', | ||
110 | }; | 117 | }; |
111 | 118 | ||
112 | export const DEFAULT_FEATURES_CONFIG = { | 119 | export const DEFAULT_FEATURES_CONFIG = { |
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js index ee5e3615c..6dd21f961 100644 --- a/src/containers/settings/EditSettingsScreen.js +++ b/src/containers/settings/EditSettingsScreen.js | |||
@@ -11,7 +11,7 @@ import TodosStore from '../../features/todos/store'; | |||
11 | import Form from '../../lib/Form'; | 11 | import Form from '../../lib/Form'; |
12 | import { APP_LOCALES, SPELLCHECKER_LOCALES } from '../../i18n/languages'; | 12 | import { APP_LOCALES, SPELLCHECKER_LOCALES } from '../../i18n/languages'; |
13 | import { | 13 | import { |
14 | DEFAULT_APP_SETTINGS, HIBERNATION_STRATEGIES, SIDEBAR_WIDTH, ICON_SIZES, | 14 | DEFAULT_APP_SETTINGS, HIBERNATION_STRATEGIES, SIDEBAR_WIDTH, ICON_SIZES, NAVIGATION_BAR_BEHAVIOURS, |
15 | } from '../../config'; | 15 | } from '../../config'; |
16 | import { config as spellcheckerConfig } from '../../features/spellchecker'; | 16 | import { config as spellcheckerConfig } from '../../features/spellchecker'; |
17 | 17 | ||
@@ -56,9 +56,9 @@ const messages = defineMessages({ | |||
56 | id: 'settings.app.form.privateNotifications', | 56 | id: 'settings.app.form.privateNotifications', |
57 | defaultMessage: '!!!Don\'t show message content in notifications', | 57 | defaultMessage: '!!!Don\'t show message content in notifications', |
58 | }, | 58 | }, |
59 | showServiceNavigationBar: { | 59 | navigationBarBehaviour: { |
60 | id: 'settings.app.form.showServiceNavigationBar', | 60 | id: 'settings.app.form.navigationBarBehaviour', |
61 | defaultMessage: '!!!Always show service navigation bar', | 61 | defaultMessage: '!!!Navigation bar behaviour', |
62 | }, | 62 | }, |
63 | sentry: { | 63 | sentry: { |
64 | id: 'settings.app.form.sentry', | 64 | id: 'settings.app.form.sentry', |
@@ -194,7 +194,7 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
194 | startMinimized: settingsData.startMinimized, | 194 | startMinimized: settingsData.startMinimized, |
195 | minimizeToSystemTray: settingsData.minimizeToSystemTray, | 195 | minimizeToSystemTray: settingsData.minimizeToSystemTray, |
196 | privateNotifications: settingsData.privateNotifications, | 196 | privateNotifications: settingsData.privateNotifications, |
197 | showServiceNavigationBar: settingsData.showServiceNavigationBar, | 197 | navigationBarBehaviour: settingsData.navigationBarBehaviour, |
198 | sentry: settingsData.sentry, | 198 | sentry: settingsData.sentry, |
199 | hibernate: settingsData.hibernate, | 199 | hibernate: settingsData.hibernate, |
200 | hibernationStrategy: settingsData.hibernationStrategy, | 200 | hibernationStrategy: settingsData.hibernationStrategy, |
@@ -260,6 +260,11 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
260 | locales: APP_LOCALES, | 260 | locales: APP_LOCALES, |
261 | }); | 261 | }); |
262 | 262 | ||
263 | const navigationBarBehaviours = getSelectOptions({ | ||
264 | locales: NAVIGATION_BAR_BEHAVIOURS, | ||
265 | sort: false, | ||
266 | }); | ||
267 | |||
263 | const hibernationStrategies = getSelectOptions({ | 268 | const hibernationStrategies = getSelectOptions({ |
264 | locales: HIBERNATION_STRATEGIES, | 269 | locales: HIBERNATION_STRATEGIES, |
265 | sort: false, | 270 | sort: false, |
@@ -317,10 +322,11 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
317 | value: settings.all.app.privateNotifications, | 322 | value: settings.all.app.privateNotifications, |
318 | default: DEFAULT_APP_SETTINGS.privateNotifications, | 323 | default: DEFAULT_APP_SETTINGS.privateNotifications, |
319 | }, | 324 | }, |
320 | showServiceNavigationBar: { | 325 | navigationBarBehaviour: { |
321 | label: intl.formatMessage(messages.showServiceNavigationBar), | 326 | label: intl.formatMessage(messages.navigationBarBehaviour), |
322 | value: settings.all.app.showServiceNavigationBar, | 327 | value: settings.all.app.navigationBarBehaviour, |
323 | default: DEFAULT_APP_SETTINGS.showServiceNavigationBar, | 328 | default: DEFAULT_APP_SETTINGS.navigationBarBehaviour, |
329 | options: navigationBarBehaviours, | ||
324 | }, | 330 | }, |
325 | sentry: { | 331 | sentry: { |
326 | label: intl.formatMessage(messages.sentry), | 332 | label: intl.formatMessage(messages.sentry), |
diff --git a/src/i18n/locales/defaultMessages.json b/src/i18n/locales/defaultMessages.json index 0ea45b977..211214d93 100644 --- a/src/i18n/locales/defaultMessages.json +++ b/src/i18n/locales/defaultMessages.json | |||
@@ -4214,15 +4214,15 @@ | |||
4214 | } | 4214 | } |
4215 | }, | 4215 | }, |
4216 | { | 4216 | { |
4217 | "defaultMessage": "!!!Always show service navigation bar", | 4217 | "defaultMessage": "!!!Navigation bar behaviour", |
4218 | "end": { | 4218 | "end": { |
4219 | "column": 3, | 4219 | "column": 3, |
4220 | "line": 62 | 4220 | "line": 62 |
4221 | }, | 4221 | }, |
4222 | "file": "src/containers/settings/EditSettingsScreen.js", | 4222 | "file": "src/containers/settings/EditSettingsScreen.js", |
4223 | "id": "settings.app.form.showServiceNavigationBar", | 4223 | "id": "settings.app.form.navigationBarBehaviour", |
4224 | "start": { | 4224 | "start": { |
4225 | "column": 28, | 4225 | "column": 26, |
4226 | "line": 59 | 4226 | "line": 59 |
4227 | } | 4227 | } |
4228 | }, | 4228 | }, |
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index 935b8550c..36494724b 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json | |||
@@ -284,6 +284,7 @@ | |||
284 | "settings.app.form.language": "Language", | 284 | "settings.app.form.language": "Language", |
285 | "settings.app.form.lockPassword": "Password", | 285 | "settings.app.form.lockPassword": "Password", |
286 | "settings.app.form.minimizeToSystemTray": "Minimize Ferdi to system tray", | 286 | "settings.app.form.minimizeToSystemTray": "Minimize Ferdi to system tray", |
287 | "settings.app.form.navigationBarBehaviour": "Navigation bar behaviour", | ||
287 | "settings.app.form.noUpdates": "Disable updates", | 288 | "settings.app.form.noUpdates": "Disable updates", |
288 | "settings.app.form.privateNotifications": "Don't show message content in notifications", | 289 | "settings.app.form.privateNotifications": "Don't show message content in notifications", |
289 | "settings.app.form.runInBackground": "Keep Ferdi in background when closing the window", | 290 | "settings.app.form.runInBackground": "Keep Ferdi in background when closing the window", |
@@ -295,7 +296,6 @@ | |||
295 | "settings.app.form.serviceRibbonWidth": "Sidebar width", | 296 | "settings.app.form.serviceRibbonWidth": "Sidebar width", |
296 | "settings.app.form.showDisabledServices": "Display disabled services tabs", | 297 | "settings.app.form.showDisabledServices": "Display disabled services tabs", |
297 | "settings.app.form.showMessagesBadgesWhenMuted": "Show unread message badge when notifications are disabled", | 298 | "settings.app.form.showMessagesBadgesWhenMuted": "Show unread message badge when notifications are disabled", |
298 | "settings.app.form.showServiceNavigationBar": "Always show service navigation bar", | ||
299 | "settings.app.form.startMinimized": "Start minimized in tray", | 299 | "settings.app.form.startMinimized": "Start minimized in tray", |
300 | "settings.app.form.todoServer": "Todo Server", | 300 | "settings.app.form.todoServer": "Todo Server", |
301 | "settings.app.form.universalDarkMode": "Enable universal Dark Mode", | 301 | "settings.app.form.universalDarkMode": "Enable universal Dark Mode", |
diff --git a/src/i18n/messages/src/containers/settings/EditSettingsScreen.json b/src/i18n/messages/src/containers/settings/EditSettingsScreen.json index 98abb0f2b..fdf49bbb6 100644 --- a/src/i18n/messages/src/containers/settings/EditSettingsScreen.json +++ b/src/i18n/messages/src/containers/settings/EditSettingsScreen.json | |||
@@ -91,12 +91,12 @@ | |||
91 | } | 91 | } |
92 | }, | 92 | }, |
93 | { | 93 | { |
94 | "id": "settings.app.form.showServiceNavigationBar", | 94 | "id": "settings.app.form.navigationBarBehaviour", |
95 | "defaultMessage": "!!!Always show service navigation bar", | 95 | "defaultMessage": "!!!Navigation bar behaviour", |
96 | "file": "src/containers/settings/EditSettingsScreen.js", | 96 | "file": "src/containers/settings/EditSettingsScreen.js", |
97 | "start": { | 97 | "start": { |
98 | "line": 59, | 98 | "line": 59, |
99 | "column": 28 | 99 | "column": 26 |
100 | }, | 100 | }, |
101 | "end": { | 101 | "end": { |
102 | "line": 62, | 102 | "line": 62, |
diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js index da63bc972..43f00b723 100644 --- a/src/stores/SettingsStore.js +++ b/src/stores/SettingsStore.js | |||
@@ -250,5 +250,25 @@ export default class SettingsStore extends Store { | |||
250 | }, | 250 | }, |
251 | }); | 251 | }); |
252 | } | 252 | } |
253 | |||
254 | if (!this.all.migration['5.4.4-beta.2-settings']) { | ||
255 | const { | ||
256 | showServiceNavigationBar, | ||
257 | } = this.all.app; | ||
258 | |||
259 | this.actions.settings.update({ | ||
260 | type: 'app', | ||
261 | data: { | ||
262 | navigationBarBehaviour: showServiceNavigationBar ? 'custom' : 'never', | ||
263 | }, | ||
264 | }); | ||
265 | |||
266 | this.actions.settings.update({ | ||
267 | type: 'migration', | ||
268 | data: { | ||
269 | '5.4.4-beta.2-settings': true, | ||
270 | }, | ||
271 | }); | ||
272 | } | ||
253 | } | 273 | } |
254 | } | 274 | } |