diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Menu.js | 81 |
1 files changed, 77 insertions, 4 deletions
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index 094caf058..b877c6555 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -7,6 +7,8 @@ import { workspaceStore } from '../features/workspaces/index'; | |||
7 | import { workspaceActions } from '../features/workspaces/actions'; | 7 | import { workspaceActions } from '../features/workspaces/actions'; |
8 | import { announcementActions } from '../features/announcements/actions'; | 8 | import { announcementActions } from '../features/announcements/actions'; |
9 | import { announcementsStore } from '../features/announcements'; | 9 | import { announcementsStore } from '../features/announcements'; |
10 | import { todosStore } from '../features/todos'; | ||
11 | import { todoActions } from '../features/todos/actions'; | ||
10 | 12 | ||
11 | const { app, Menu, dialog } = remote; | 13 | const { app, Menu, dialog } = remote; |
12 | 14 | ||
@@ -95,6 +97,10 @@ const menuItems = defineMessages({ | |||
95 | id: 'menu.view.toggleDevTools', | 97 | id: 'menu.view.toggleDevTools', |
96 | defaultMessage: '!!!Toggle Developer Tools', | 98 | defaultMessage: '!!!Toggle Developer Tools', |
97 | }, | 99 | }, |
100 | toggleTodosDevTools: { | ||
101 | id: 'menu.view.toggleTodosDevTools', | ||
102 | defaultMessage: '!!!Toggle Todos Developer Tools', | ||
103 | }, | ||
98 | toggleServiceDevTools: { | 104 | toggleServiceDevTools: { |
99 | id: 'menu.view.toggleServiceDevTools', | 105 | id: 'menu.view.toggleServiceDevTools', |
100 | defaultMessage: '!!!Toggle Service Developer Tools', | 106 | defaultMessage: '!!!Toggle Service Developer Tools', |
@@ -105,7 +111,7 @@ const menuItems = defineMessages({ | |||
105 | }, | 111 | }, |
106 | reloadFranz: { | 112 | reloadFranz: { |
107 | id: 'menu.view.reloadFranz', | 113 | id: 'menu.view.reloadFranz', |
108 | defaultMessage: '!!!Reload Franz', | 114 | defaultMessage: '!!!Reload Ferdi', |
109 | }, | 115 | }, |
110 | minimize: { | 116 | minimize: { |
111 | id: 'menu.window.minimize', | 117 | id: 'menu.window.minimize', |
@@ -169,7 +175,7 @@ const menuItems = defineMessages({ | |||
169 | }, | 175 | }, |
170 | about: { | 176 | about: { |
171 | id: 'menu.app.about', | 177 | id: 'menu.app.about', |
172 | defaultMessage: '!!!About Franz', | 178 | defaultMessage: '!!!About Ferdi', |
173 | }, | 179 | }, |
174 | announcement: { | 180 | announcement: { |
175 | id: 'menu.app.announcement', | 181 | id: 'menu.app.announcement', |
@@ -239,6 +245,22 @@ const menuItems = defineMessages({ | |||
239 | id: 'menu.workspaces.defaultWorkspace', | 245 | id: 'menu.workspaces.defaultWorkspace', |
240 | defaultMessage: '!!!Default', | 246 | defaultMessage: '!!!Default', |
241 | }, | 247 | }, |
248 | todos: { | ||
249 | id: 'menu.todos', | ||
250 | defaultMessage: '!!!Todos', | ||
251 | }, | ||
252 | openTodosDrawer: { | ||
253 | id: 'menu.Todoss.openTodosDrawer', | ||
254 | defaultMessage: '!!!Open Todos drawer', | ||
255 | }, | ||
256 | closeTodosDrawer: { | ||
257 | id: 'menu.Todoss.closeTodosDrawer', | ||
258 | defaultMessage: '!!!Close Todos drawer', | ||
259 | }, | ||
260 | enableTodos: { | ||
261 | id: 'menu.todos.enableTodos', | ||
262 | defaultMessage: '!!!Enable Todos', | ||
263 | }, | ||
242 | }); | 264 | }); |
243 | 265 | ||
244 | function getActiveWebview() { | 266 | function getActiveWebview() { |
@@ -347,6 +369,11 @@ const _templateFactory = intl => [ | |||
347 | visible: workspaceStore.isFeatureEnabled, | 369 | visible: workspaceStore.isFeatureEnabled, |
348 | }, | 370 | }, |
349 | { | 371 | { |
372 | label: intl.formatMessage(menuItems.todos), | ||
373 | submenu: [], | ||
374 | visible: todosStore.isFeatureEnabled, | ||
375 | }, | ||
376 | { | ||
350 | label: intl.formatMessage(menuItems.window), | 377 | label: intl.formatMessage(menuItems.window), |
351 | role: 'window', | 378 | role: 'window', |
352 | submenu: [ | 379 | submenu: [ |
@@ -619,6 +646,17 @@ export default class FranzMenu { | |||
619 | enabled: this.stores.user.isLoggedIn && this.stores.services.enabled.length > 0, | 646 | enabled: this.stores.user.isLoggedIn && this.stores.services.enabled.length > 0, |
620 | }); | 647 | }); |
621 | 648 | ||
649 | if (this.stores.features.features.isTodosEnabled) { | ||
650 | tpl[1].submenu.push({ | ||
651 | label: intl.formatMessage(menuItems.toggleTodosDevTools), | ||
652 | accelerator: `${cmdKey}+Shift+Alt+O`, | ||
653 | click: () => { | ||
654 | const webview = document.querySelector('webview[partition="persist:todos"]'); | ||
655 | if (webview) webview.openDevTools(); | ||
656 | }, | ||
657 | }); | ||
658 | } | ||
659 | |||
622 | tpl[1].submenu.unshift({ | 660 | tpl[1].submenu.unshift({ |
623 | label: intl.formatMessage(menuItems.reloadService), | 661 | label: intl.formatMessage(menuItems.reloadService), |
624 | id: 'reloadService', // TODO: needed? | 662 | id: 'reloadService', // TODO: needed? |
@@ -704,8 +742,8 @@ export default class FranzMenu { | |||
704 | click: () => { | 742 | click: () => { |
705 | dialog.showMessageBox({ | 743 | dialog.showMessageBox({ |
706 | type: 'info', | 744 | type: 'info', |
707 | title: 'Franz', | 745 | title: 'Franz Ferdinand', |
708 | message: 'Franz', | 746 | message: 'Ferdi', |
709 | detail: `Version: ${remote.app.getVersion()}\nRelease: ${process.versions.electron} / ${process.platform} / ${process.arch}`, | 747 | detail: `Version: ${remote.app.getVersion()}\nRelease: ${process.versions.electron} / ${process.platform} / ${process.arch}`, |
710 | }); | 748 | }); |
711 | }, | 749 | }, |
@@ -771,6 +809,10 @@ export default class FranzMenu { | |||
771 | tpl[4].submenu = this.workspacesMenu(); | 809 | tpl[4].submenu = this.workspacesMenu(); |
772 | } | 810 | } |
773 | 811 | ||
812 | if (todosStore.isFeatureEnabled) { | ||
813 | tpl[5].submenu = this.todosMenu(); | ||
814 | } | ||
815 | |||
774 | tpl[tpl.length - 1].submenu.push({ | 816 | tpl[tpl.length - 1].submenu.push({ |
775 | type: 'separator', | 817 | type: 'separator', |
776 | }, this.debugMenu()); | 818 | }, this.debugMenu()); |
@@ -882,6 +924,37 @@ export default class FranzMenu { | |||
882 | return menu; | 924 | return menu; |
883 | } | 925 | } |
884 | 926 | ||
927 | todosMenu() { | ||
928 | const { isTodosPanelVisible, isFeatureEnabledByUser } = this.stores.todos; | ||
929 | const { intl } = window.franz; | ||
930 | const menu = []; | ||
931 | |||
932 | const drawerLabel = isTodosPanelVisible ? menuItems.closeTodosDrawer : menuItems.openTodosDrawer; | ||
933 | |||
934 | menu.push({ | ||
935 | label: intl.formatMessage(drawerLabel), | ||
936 | accelerator: `${cmdKey}+T`, | ||
937 | click: () => { | ||
938 | todoActions.toggleTodosPanel(); | ||
939 | }, | ||
940 | enabled: this.stores.user.isLoggedIn && isFeatureEnabledByUser, | ||
941 | }, { | ||
942 | type: 'separator', | ||
943 | }); | ||
944 | |||
945 | if (!isFeatureEnabledByUser) { | ||
946 | menu.push({ | ||
947 | label: intl.formatMessage(menuItems.enableTodos), | ||
948 | click: () => { | ||
949 | todoActions.toggleTodosFeatureVisibility(); | ||
950 | }, | ||
951 | }); | ||
952 | } | ||
953 | |||
954 | return menu; | ||
955 | } | ||
956 | |||
957 | |||
885 | debugMenu() { | 958 | debugMenu() { |
886 | const { intl } = window.ferdi; | 959 | const { intl } = window.ferdi; |
887 | 960 | ||