diff options
author | 2022-06-24 15:29:40 +0100 | |
---|---|---|
committer | 2022-06-24 22:26:52 +0530 | |
commit | 68d4a04a02335493e35545d8d5f43680b64cc9a2 (patch) | |
tree | 785cdb991c3067fef95c648319af8e2104b949fe /src | |
parent | fix: disable todos feature by default (#355) (diff) | |
download | ferdium-app-68d4a04a02335493e35545d8d5f43680b64cc9a2.tar.gz ferdium-app-68d4a04a02335493e35545d8d5f43680b64cc9a2.tar.zst ferdium-app-68d4a04a02335493e35545d8d5f43680b64cc9a2.zip |
Add split mode toggle to side bar and hide collapse buttonv6.0.0-nightly-alphrag.57.7
Diffstat (limited to 'src')
-rw-r--r-- | src/components/layout/Sidebar.js | 33 | ||||
-rw-r--r-- | src/components/settings/settings/EditSettingsForm.js | 4 | ||||
-rw-r--r-- | src/config.ts | 2 | ||||
-rw-r--r-- | src/containers/settings/EditSettingsScreen.js | 20 | ||||
-rw-r--r-- | src/environment.ts | 2 | ||||
-rw-r--r-- | src/i18n/locales/defaultMessages.json | 13 | ||||
-rw-r--r-- | src/i18n/locales/en-US.json | 4 | ||||
-rw-r--r-- | src/lib/Menu.js | 20 |
8 files changed, 96 insertions, 2 deletions
diff --git a/src/components/layout/Sidebar.js b/src/components/layout/Sidebar.js index 0d3a7c20c..1d3c81dcd 100644 --- a/src/components/layout/Sidebar.js +++ b/src/components/layout/Sidebar.js | |||
@@ -14,6 +14,7 @@ import { | |||
14 | mdiMenu, | 14 | mdiMenu, |
15 | mdiChevronDown, | 15 | mdiChevronDown, |
16 | mdiChevronRight, | 16 | mdiChevronRight, |
17 | mdiViewSplitVertical, | ||
17 | } from '@mdi/js'; | 18 | } from '@mdi/js'; |
18 | 19 | ||
19 | import Tabbar from '../services/tabs/Tabbar'; | 20 | import Tabbar from '../services/tabs/Tabbar'; |
@@ -23,6 +24,7 @@ import { | |||
23 | todosToggleShortcutKey, | 24 | todosToggleShortcutKey, |
24 | workspaceToggleShortcutKey, | 25 | workspaceToggleShortcutKey, |
25 | addNewServiceShortcutKey, | 26 | addNewServiceShortcutKey, |
27 | splitModeToggleShortcutKey, | ||
26 | muteFerdiumShortcutKey, | 28 | muteFerdiumShortcutKey, |
27 | } from '../../environment'; | 29 | } from '../../environment'; |
28 | import { todosStore } from '../../features/todos'; | 30 | import { todosStore } from '../../features/todos'; |
@@ -37,6 +39,10 @@ const messages = defineMessages({ | |||
37 | id: 'sidebar.addNewService', | 39 | id: 'sidebar.addNewService', |
38 | defaultMessage: 'Add new service', | 40 | defaultMessage: 'Add new service', |
39 | }, | 41 | }, |
42 | splitModeToggle: { | ||
43 | id: 'sidebar.splitModeToggle', | ||
44 | defaultMessage: 'Split Mode Toggle', | ||
45 | }, | ||
40 | mute: { | 46 | mute: { |
41 | id: 'sidebar.muteApp', | 47 | id: 'sidebar.muteApp', |
42 | defaultMessage: 'Disable notifications & audio', | 48 | defaultMessage: 'Disable notifications & audio', |
@@ -137,11 +143,14 @@ class Sidebar extends Component { | |||
137 | isTodosServiceActive, | 143 | isTodosServiceActive, |
138 | } = this.props; | 144 | } = this.props; |
139 | const { | 145 | const { |
146 | hideCollapseButton, | ||
140 | hideRecipesButton, | 147 | hideRecipesButton, |
141 | hideWorkspacesButton, | 148 | hideWorkspacesButton, |
142 | hideNotificationsButton, | 149 | hideNotificationsButton, |
143 | hideSettingsButton, | 150 | hideSettingsButton, |
144 | useVerticalStyle | 151 | hideSplitModeButton, |
152 | useVerticalStyle, | ||
153 | splitMode, | ||
145 | } = stores.settings.app; | 154 | } = stores.settings.app; |
146 | const { intl } = this.props; | 155 | const { intl } = this.props; |
147 | const todosToggleMessage = todosStore.isTodosPanelVisible | 156 | const todosToggleMessage = todosStore.isTodosPanelVisible |
@@ -157,6 +166,7 @@ class Sidebar extends Component { | |||
157 | !hideWorkspacesButton, | 166 | !hideWorkspacesButton, |
158 | !hideNotificationsButton, | 167 | !hideNotificationsButton, |
159 | !hideSettingsButton, | 168 | !hideSettingsButton, |
169 | !hideSplitModeButton, | ||
160 | todosStore.isFeatureEnabledByUser | 170 | todosStore.isFeatureEnabledByUser |
161 | ].filter(Boolean).length; | 171 | ].filter(Boolean).length; |
162 | 172 | ||
@@ -169,7 +179,7 @@ class Sidebar extends Component { | |||
169 | useVerticalStyle={stores.settings.all.app.useVerticalStyle} | 179 | useVerticalStyle={stores.settings.all.app.useVerticalStyle} |
170 | /> | 180 | /> |
171 | <> | 181 | <> |
172 | {numberActiveButtons <= 1 ? ( | 182 | {numberActiveButtons <= 1 || hideCollapseButton ? ( |
173 | null | 183 | null |
174 | ) : | 184 | ) : |
175 | <button | 185 | <button |
@@ -199,6 +209,25 @@ class Sidebar extends Component { | |||
199 | <Icon icon={mdiPlusBox} size={1.5} /> | 209 | <Icon icon={mdiPlusBox} size={1.5} /> |
200 | </button> | 210 | </button> |
201 | ) : null} | 211 | ) : null} |
212 | {!hideSplitModeButton && !this.state.isCollapsed ? ( | ||
213 | <button | ||
214 | type="button" | ||
215 | onClick={() => { | ||
216 | actions.settings.update({ | ||
217 | type: 'app', | ||
218 | data: { | ||
219 | splitMode: !splitMode, | ||
220 | }, | ||
221 | }); | ||
222 | }} | ||
223 | className="sidebar__button sidebar__button--split-mode-toggle" | ||
224 | data-tip={`${intl.formatMessage( | ||
225 | messages.splitModeToggle, | ||
226 | )} (${splitModeToggleShortcutKey(false)})`} | ||
227 | > | ||
228 | <Icon icon={mdiViewSplitVertical} size={1.5} /> | ||
229 | </button> | ||
230 | ) : null} | ||
202 | {!hideWorkspacesButton && !this.state.isCollapsed ? ( | 231 | {!hideWorkspacesButton && !this.state.isCollapsed ? ( |
203 | <button | 232 | <button |
204 | type="button" | 233 | type="button" |
diff --git a/src/components/settings/settings/EditSettingsForm.js b/src/components/settings/settings/EditSettingsForm.js index 3d46fd376..ce090ea99 100644 --- a/src/components/settings/settings/EditSettingsForm.js +++ b/src/components/settings/settings/EditSettingsForm.js | |||
@@ -679,8 +679,12 @@ class EditSettingsForm extends Component { | |||
679 | 679 | ||
680 | <Toggle field={form.$('useVerticalStyle')} /> | 680 | <Toggle field={form.$('useVerticalStyle')} /> |
681 | 681 | ||
682 | <Toggle field={form.$('hideCollapseButton')} /> | ||
683 | |||
682 | <Toggle field={form.$('hideRecipesButton')} /> | 684 | <Toggle field={form.$('hideRecipesButton')} /> |
683 | 685 | ||
686 | <Toggle field={form.$('hideSplitModeButton')} /> | ||
687 | |||
684 | <Toggle field={form.$('hideWorkspacesButton')} /> | 688 | <Toggle field={form.$('hideWorkspacesButton')} /> |
685 | 689 | ||
686 | <Toggle field={form.$('hideNotificationsButton')} /> | 690 | <Toggle field={form.$('hideNotificationsButton')} /> |
diff --git a/src/config.ts b/src/config.ts index 9791d27a6..9a459f338 100644 --- a/src/config.ts +++ b/src/config.ts | |||
@@ -262,7 +262,9 @@ export const DEFAULT_APP_SETTINGS = { | |||
262 | navigationBarBehaviour: 'custom', | 262 | navigationBarBehaviour: 'custom', |
263 | searchEngine: SEARCH_ENGINE_STARTPAGE, | 263 | searchEngine: SEARCH_ENGINE_STARTPAGE, |
264 | useVerticalStyle: false, | 264 | useVerticalStyle: false, |
265 | hideCollapseButton: false, | ||
265 | hideRecipesButton: false, | 266 | hideRecipesButton: false, |
267 | hideSplitModeButton: true, | ||
266 | useGrayscaleServices: false, | 268 | useGrayscaleServices: false, |
267 | grayscaleServicesDim: 50, | 269 | grayscaleServicesDim: 50, |
268 | hideWorkspacesButton: false, | 270 | hideWorkspacesButton: false, |
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js index 898a2f482..867db6f08 100644 --- a/src/containers/settings/EditSettingsScreen.js +++ b/src/containers/settings/EditSettingsScreen.js | |||
@@ -206,10 +206,18 @@ const messages = defineMessages({ | |||
206 | id: 'settings.app.form.useVerticalStyle', | 206 | id: 'settings.app.form.useVerticalStyle', |
207 | defaultMessage: 'Use horizontal style', | 207 | defaultMessage: 'Use horizontal style', |
208 | }, | 208 | }, |
209 | hideCollapseButton: { | ||
210 | id: 'settings.app.form.hideCollapseButton', | ||
211 | defaultMessage: 'Hide Collapse button', | ||
212 | }, | ||
209 | hideRecipesButton: { | 213 | hideRecipesButton: { |
210 | id: 'settings.app.form.hideRecipesButton', | 214 | id: 'settings.app.form.hideRecipesButton', |
211 | defaultMessage: 'Hide Recipes button', | 215 | defaultMessage: 'Hide Recipes button', |
212 | }, | 216 | }, |
217 | hideSplitModeButton: { | ||
218 | id: 'settings.app.form.hideSplitModeButton', | ||
219 | defaultMessage: 'Hide Split Mode button', | ||
220 | }, | ||
213 | useGrayscaleServices: { | 221 | useGrayscaleServices: { |
214 | id: 'settings.app.form.useGrayscaleServices', | 222 | id: 'settings.app.form.useGrayscaleServices', |
215 | defaultMessage: 'Use grayscale services', | 223 | defaultMessage: 'Use grayscale services', |
@@ -369,7 +377,9 @@ class EditSettingsScreen extends Component { | |||
369 | settingsData.enableLongPressServiceHint, | 377 | settingsData.enableLongPressServiceHint, |
370 | ), | 378 | ), |
371 | useVerticalStyle: Boolean(settingsData.useVerticalStyle), | 379 | useVerticalStyle: Boolean(settingsData.useVerticalStyle), |
380 | hideCollapseButton: Boolean(settingsData.hideCollapseButton), | ||
372 | hideRecipesButton: Boolean(settingsData.hideRecipesButton), | 381 | hideRecipesButton: Boolean(settingsData.hideRecipesButton), |
382 | hideSplitModeButton: Boolean(settingsData.hideSplitModeButton), | ||
373 | useGrayscaleServices: Boolean(settingsData.useGrayscaleServices), | 383 | useGrayscaleServices: Boolean(settingsData.useGrayscaleServices), |
374 | grayscaleServicesDim: Number(settingsData.grayscaleServicesDim), | 384 | grayscaleServicesDim: Number(settingsData.grayscaleServicesDim), |
375 | hideWorkspacesButton: Boolean(settingsData.hideWorkspacesButton), | 385 | hideWorkspacesButton: Boolean(settingsData.hideWorkspacesButton), |
@@ -733,11 +743,21 @@ class EditSettingsScreen extends Component { | |||
733 | value: settings.all.app.useVerticalStyle, | 743 | value: settings.all.app.useVerticalStyle, |
734 | default: DEFAULT_APP_SETTINGS.useVerticalStyle, | 744 | default: DEFAULT_APP_SETTINGS.useVerticalStyle, |
735 | }, | 745 | }, |
746 | hideCollapseButton: { | ||
747 | label: intl.formatMessage(messages.hideCollapseButton), | ||
748 | value: settings.all.app.hideCollapseButton, | ||
749 | default: DEFAULT_APP_SETTINGS.hideCollapseButton, | ||
750 | }, | ||
736 | hideRecipesButton: { | 751 | hideRecipesButton: { |
737 | label: intl.formatMessage(messages.hideRecipesButton), | 752 | label: intl.formatMessage(messages.hideRecipesButton), |
738 | value: settings.all.app.hideRecipesButton, | 753 | value: settings.all.app.hideRecipesButton, |
739 | default: DEFAULT_APP_SETTINGS.hideRecipesButton, | 754 | default: DEFAULT_APP_SETTINGS.hideRecipesButton, |
740 | }, | 755 | }, |
756 | hideSplitModeButton: { | ||
757 | label: intl.formatMessage(messages.hideSplitModeButton), | ||
758 | value: settings.all.app.hideSplitModeButton, | ||
759 | default: DEFAULT_APP_SETTINGS.hideSplitModeButton, | ||
760 | }, | ||
741 | useGrayscaleServices: { | 761 | useGrayscaleServices: { |
742 | label: intl.formatMessage(messages.useGrayscaleServices), | 762 | label: intl.formatMessage(messages.useGrayscaleServices), |
743 | value: settings.all.app.useGrayscaleServices, | 763 | value: settings.all.app.useGrayscaleServices, |
diff --git a/src/environment.ts b/src/environment.ts index 631a4343c..7208b16b6 100644 --- a/src/environment.ts +++ b/src/environment.ts | |||
@@ -37,5 +37,7 @@ export const muteFerdiumShortcutKey = (isAccelerator = true) => | |||
37 | `${cmdOrCtrlShortcutKey(isAccelerator)}+${shiftKey(isAccelerator)}+M`; | 37 | `${cmdOrCtrlShortcutKey(isAccelerator)}+${shiftKey(isAccelerator)}+M`; |
38 | export const addNewServiceShortcutKey = (isAccelerator = true) => | 38 | export const addNewServiceShortcutKey = (isAccelerator = true) => |
39 | `${cmdOrCtrlShortcutKey(isAccelerator)}+N`; | 39 | `${cmdOrCtrlShortcutKey(isAccelerator)}+N`; |
40 | export const splitModeToggleShortcutKey = (isAccelerator = true) => | ||
41 | `${cmdOrCtrlShortcutKey(isAccelerator)}+${altKey(isAccelerator)}+S`; | ||
40 | export const settingsShortcutKey = (isAccelerator = true) => | 42 | export const settingsShortcutKey = (isAccelerator = true) => |
41 | `${cmdOrCtrlShortcutKey(isAccelerator)}+${isMac ? ',' : 'P'}`; | 43 | `${cmdOrCtrlShortcutKey(isAccelerator)}+${isMac ? ',' : 'P'}`; |
diff --git a/src/i18n/locales/defaultMessages.json b/src/i18n/locales/defaultMessages.json index 09c793bfe..412b2cadc 100644 --- a/src/i18n/locales/defaultMessages.json +++ b/src/i18n/locales/defaultMessages.json | |||
@@ -1115,6 +1115,19 @@ | |||
1115 | } | 1115 | } |
1116 | }, | 1116 | }, |
1117 | { | 1117 | { |
1118 | "defaultMessage": "!!!Split Mode Toggle", | ||
1119 | "end": { | ||
1120 | "column": 3, | ||
1121 | "line": 27 | ||
1122 | }, | ||
1123 | "file": "src/components/layout/Sidebar.js", | ||
1124 | "id": "sidebar.splitModeToggle", | ||
1125 | "start": { | ||
1126 | "column": 17, | ||
1127 | "line": 24 | ||
1128 | } | ||
1129 | }, | ||
1130 | { | ||
1118 | "defaultMessage": "!!!Disable notifications & audio", | 1131 | "defaultMessage": "!!!Disable notifications & audio", |
1119 | "end": { | 1132 | "end": { |
1120 | "column": 3, | 1133 | "column": 3, |
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index f51c798ac..ccb21a39a 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json | |||
@@ -132,6 +132,7 @@ | |||
132 | "menu.view.toggleDevTools": "Toggle Developer Tools", | 132 | "menu.view.toggleDevTools": "Toggle Developer Tools", |
133 | "menu.view.toggleFullScreen": "Toggle Full Screen", | 133 | "menu.view.toggleFullScreen": "Toggle Full Screen", |
134 | "menu.view.toggleNavigationBar": "Toggle Navigation Bar", | 134 | "menu.view.toggleNavigationBar": "Toggle Navigation Bar", |
135 | "menu.view.splitModeToggle": "Toggle Split Mode", | ||
135 | "menu.view.toggleServiceDevTools": "Toggle Service Developer Tools", | 136 | "menu.view.toggleServiceDevTools": "Toggle Service Developer Tools", |
136 | "menu.view.toggleTodosDevTools": "Toggle Todos Developer Tools", | 137 | "menu.view.toggleTodosDevTools": "Toggle Todos Developer Tools", |
137 | "menu.view.zoomIn": "Zoom In", | 138 | "menu.view.zoomIn": "Zoom In", |
@@ -218,7 +219,9 @@ | |||
218 | "settings.app.form.hibernateOnStartup": "Keep services in hibernation on startup", | 219 | "settings.app.form.hibernateOnStartup": "Keep services in hibernation on startup", |
219 | "settings.app.form.hibernationStrategy": "Hibernation strategy", | 220 | "settings.app.form.hibernationStrategy": "Hibernation strategy", |
220 | "settings.app.form.hideNotificationsButton": "Hide Notifications & Sound button", | 221 | "settings.app.form.hideNotificationsButton": "Hide Notifications & Sound button", |
222 | "settings.app.form.hideCollapseButton": "Hide Collapse button", | ||
221 | "settings.app.form.hideRecipesButton": "Hide Recipes button", | 223 | "settings.app.form.hideRecipesButton": "Hide Recipes button", |
224 | "settings.app.form.hideSplitModeButton": "Hide Split Mode button", | ||
222 | "settings.app.form.hideSettingsButton": "Hide Settings button", | 225 | "settings.app.form.hideSettingsButton": "Hide Settings button", |
223 | "settings.app.form.hideWorkspacesButton": "Hide Workspace Drawer button", | 226 | "settings.app.form.hideWorkspacesButton": "Hide Workspace Drawer button", |
224 | "settings.app.form.iconSize": "Service icon size", | 227 | "settings.app.form.iconSize": "Service icon size", |
@@ -419,6 +422,7 @@ | |||
419 | "setupAssistant.subheadline": "Choose from our most used services and get back on top of your messaging now.", | 422 | "setupAssistant.subheadline": "Choose from our most used services and get back on top of your messaging now.", |
420 | "setupAssistant.submit.label": "Let's go", | 423 | "setupAssistant.submit.label": "Let's go", |
421 | "sidebar.addNewService": "Add new service", | 424 | "sidebar.addNewService": "Add new service", |
425 | "sidebar.splitModeToggle": "Split Mode Toggle", | ||
422 | "sidebar.closeTodosDrawer": "Close Ferdium Todos", | 426 | "sidebar.closeTodosDrawer": "Close Ferdium Todos", |
423 | "sidebar.closeWorkspaceDrawer": "Close workspace drawer", | 427 | "sidebar.closeWorkspaceDrawer": "Close workspace drawer", |
424 | "sidebar.lockFerdium": "Lock Ferdium", | 428 | "sidebar.lockFerdium": "Lock Ferdium", |
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index 900375c2f..54c8c0b77 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -25,6 +25,7 @@ import { | |||
25 | todosToggleShortcutKey, | 25 | todosToggleShortcutKey, |
26 | workspaceToggleShortcutKey, | 26 | workspaceToggleShortcutKey, |
27 | addNewServiceShortcutKey, | 27 | addNewServiceShortcutKey, |
28 | splitModeToggleShortcutKey, | ||
28 | muteFerdiumShortcutKey, | 29 | muteFerdiumShortcutKey, |
29 | } from '../environment'; | 30 | } from '../environment'; |
30 | import { aboutAppDetails, ferdiumVersion } from '../environment-remote'; | 31 | import { aboutAppDetails, ferdiumVersion } from '../environment-remote'; |
@@ -128,6 +129,10 @@ const menuItems = defineMessages({ | |||
128 | id: 'menu.view.toggleNavigationBar', | 129 | id: 'menu.view.toggleNavigationBar', |
129 | defaultMessage: 'Toggle Navigation Bar', | 130 | defaultMessage: 'Toggle Navigation Bar', |
130 | }, | 131 | }, |
132 | splitModeToggle: { | ||
133 | id: 'menu.view.splitModeToggle', | ||
134 | defaultMessage: 'Toggle Split Mode', | ||
135 | }, | ||
131 | toggleDarkMode: { | 136 | toggleDarkMode: { |
132 | id: 'menu.view.toggleDarkMode', | 137 | id: 'menu.view.toggleDarkMode', |
133 | defaultMessage: 'Toggle Dark Mode', | 138 | defaultMessage: 'Toggle Dark Mode', |
@@ -479,6 +484,21 @@ const _titleBarTemplateFactory = (intl, locked) => [ | |||
479 | } | 484 | } |
480 | }, | 485 | }, |
481 | { | 486 | { |
487 | label: intl.formatMessage(menuItems.splitModeToggle), | ||
488 | accelerator: `${splitModeToggleShortcutKey()}`, | ||
489 | role: 'splitModeToggle', | ||
490 | type: 'checkbox', | ||
491 | checked: window['ferdium'].stores.settings.app.splitMode, | ||
492 | click: () => { | ||
493 | window['ferdium'].actions.settings.update({ | ||
494 | type: 'app', | ||
495 | data: { | ||
496 | splitMode: !window['ferdium'].stores.settings.app.splitMode, | ||
497 | } | ||
498 | }); | ||
499 | } | ||
500 | }, | ||
501 | { | ||
482 | label: intl.formatMessage(menuItems.toggleDarkMode), | 502 | label: intl.formatMessage(menuItems.toggleDarkMode), |
483 | type: 'checkbox', | 503 | type: 'checkbox', |
484 | accelerator: `${cmdOrCtrlShortcutKey()}+${shiftKey()}+D`, | 504 | accelerator: `${cmdOrCtrlShortcutKey()}+${shiftKey()}+D`, |