diff options
Diffstat (limited to 'src/lib/Menu.js')
-rw-r--r-- | src/lib/Menu.js | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index 22d788918..81efaf18f 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -8,6 +8,9 @@ import { workspaceActions } from '../features/workspaces/actions'; | |||
8 | import { gaEvent } from './analytics'; | 8 | import { gaEvent } from './analytics'; |
9 | import { announcementActions } from '../features/announcements/actions'; | 9 | import { announcementActions } from '../features/announcements/actions'; |
10 | import { announcementsStore } from '../features/announcements'; | 10 | import { announcementsStore } from '../features/announcements'; |
11 | import TodoStore from '../features/todos/store'; | ||
12 | import { GA_CATEGORY_TODOS, todosStore } from '../features/todos'; | ||
13 | import { todoActions } from '../features/todos/actions'; | ||
11 | 14 | ||
12 | const { app, Menu, dialog } = remote; | 15 | const { app, Menu, dialog } = remote; |
13 | 16 | ||
@@ -96,6 +99,10 @@ const menuItems = defineMessages({ | |||
96 | id: 'menu.view.toggleDevTools', | 99 | id: 'menu.view.toggleDevTools', |
97 | defaultMessage: '!!!Toggle Developer Tools', | 100 | defaultMessage: '!!!Toggle Developer Tools', |
98 | }, | 101 | }, |
102 | toggleTodosDevTools: { | ||
103 | id: 'menu.view.toggleTodosDevTools', | ||
104 | defaultMessage: '!!!Toggle Todos Developer Tools', | ||
105 | }, | ||
99 | toggleServiceDevTools: { | 106 | toggleServiceDevTools: { |
100 | id: 'menu.view.toggleServiceDevTools', | 107 | id: 'menu.view.toggleServiceDevTools', |
101 | defaultMessage: '!!!Toggle Service Developer Tools', | 108 | defaultMessage: '!!!Toggle Service Developer Tools', |
@@ -240,6 +247,18 @@ const menuItems = defineMessages({ | |||
240 | id: 'menu.workspaces.defaultWorkspace', | 247 | id: 'menu.workspaces.defaultWorkspace', |
241 | defaultMessage: '!!!Default', | 248 | defaultMessage: '!!!Default', |
242 | }, | 249 | }, |
250 | todos: { | ||
251 | id: 'menu.todos', | ||
252 | defaultMessage: '!!!Todos', | ||
253 | }, | ||
254 | openTodosDrawer: { | ||
255 | id: 'menu.Todoss.openTodosDrawer', | ||
256 | defaultMessage: '!!!Open Todos drawer', | ||
257 | }, | ||
258 | closeTodosDrawer: { | ||
259 | id: 'menu.Todoss.closeTodosDrawer', | ||
260 | defaultMessage: '!!!Close Todos drawer', | ||
261 | }, | ||
243 | }); | 262 | }); |
244 | 263 | ||
245 | function getActiveWebview() { | 264 | function getActiveWebview() { |
@@ -348,6 +367,11 @@ const _templateFactory = intl => [ | |||
348 | visible: workspaceStore.isFeatureEnabled, | 367 | visible: workspaceStore.isFeatureEnabled, |
349 | }, | 368 | }, |
350 | { | 369 | { |
370 | label: intl.formatMessage(menuItems.todos), | ||
371 | submenu: [], | ||
372 | visible: todosStore.isFeatureEnabled, | ||
373 | }, | ||
374 | { | ||
351 | label: intl.formatMessage(menuItems.window), | 375 | label: intl.formatMessage(menuItems.window), |
352 | role: 'window', | 376 | role: 'window', |
353 | submenu: [ | 377 | submenu: [ |
@@ -620,6 +644,17 @@ export default class FranzMenu { | |||
620 | enabled: this.stores.user.isLoggedIn && this.stores.services.enabled.length > 0, | 644 | enabled: this.stores.user.isLoggedIn && this.stores.services.enabled.length > 0, |
621 | }); | 645 | }); |
622 | 646 | ||
647 | if (this.stores.features.features.isTodosEnabled) { | ||
648 | tpl[1].submenu.push({ | ||
649 | label: intl.formatMessage(menuItems.toggleTodosDevTools), | ||
650 | accelerator: `${cmdKey}+Shift+Alt+O`, | ||
651 | click: () => { | ||
652 | const webview = document.querySelector('webview[partition="persist:todos"]'); | ||
653 | if (webview) webview.openDevTools(); | ||
654 | }, | ||
655 | }); | ||
656 | } | ||
657 | |||
623 | tpl[1].submenu.unshift({ | 658 | tpl[1].submenu.unshift({ |
624 | label: intl.formatMessage(menuItems.reloadService), | 659 | label: intl.formatMessage(menuItems.reloadService), |
625 | id: 'reloadService', // TODO: needed? | 660 | id: 'reloadService', // TODO: needed? |
@@ -772,6 +807,10 @@ export default class FranzMenu { | |||
772 | tpl[4].submenu = this.workspacesMenu(); | 807 | tpl[4].submenu = this.workspacesMenu(); |
773 | } | 808 | } |
774 | 809 | ||
810 | if (todosStore.isFeatureEnabled) { | ||
811 | tpl[5].submenu = this.todosMenu(); | ||
812 | } | ||
813 | |||
775 | tpl[tpl.length - 1].submenu.push({ | 814 | tpl[tpl.length - 1].submenu.push({ |
776 | type: 'separator', | 815 | type: 'separator', |
777 | }, this.debugMenu()); | 816 | }, this.debugMenu()); |
@@ -886,6 +925,31 @@ export default class FranzMenu { | |||
886 | return menu; | 925 | return menu; |
887 | } | 926 | } |
888 | 927 | ||
928 | todosMenu() { | ||
929 | const { isTodosPanelVisible } = TodoStore; | ||
930 | const { intl } = window.franz; | ||
931 | const menu = []; | ||
932 | |||
933 | // Open todos drawer: | ||
934 | const drawerLabel = ( | ||
935 | isTodosPanelVisible ? menuItems.closeTodosDrawer : menuItems.openTodosDrawer | ||
936 | ); | ||
937 | menu.push({ | ||
938 | label: intl.formatMessage(drawerLabel), | ||
939 | accelerator: `${cmdKey}+T`, | ||
940 | click: () => { | ||
941 | todoActions.toggleTodosPanel(); | ||
942 | gaEvent(GA_CATEGORY_TODOS, 'toggleDrawer', 'menu'); | ||
943 | }, | ||
944 | enabled: this.stores.user.isLoggedIn, | ||
945 | }, { | ||
946 | type: 'separator', | ||
947 | }); | ||
948 | |||
949 | return menu; | ||
950 | } | ||
951 | |||
952 | |||
889 | debugMenu() { | 953 | debugMenu() { |
890 | const { intl } = window.franz; | 954 | const { intl } = window.franz; |
891 | 955 | ||