diff options
author | 2019-08-02 11:41:51 +0200 | |
---|---|---|
committer | 2019-08-02 11:41:51 +0200 | |
commit | 6297d46f370092598d2ebb973bb69f2c368d7904 (patch) | |
tree | 52bdd4885537ca2fb20be32b2db9c8c4dc95f908 /src/lib | |
parent | Add separator to todos panel (diff) | |
download | ferdium-app-6297d46f370092598d2ebb973bb69f2c368d7904.tar.gz ferdium-app-6297d46f370092598d2ebb973bb69f2c368d7904.tar.zst ferdium-app-6297d46f370092598d2ebb973bb69f2c368d7904.zip |
Add option to toggle the Todos panel
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Menu.js | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index 9e491e151..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 | ||
@@ -244,7 +247,18 @@ const menuItems = defineMessages({ | |||
244 | id: 'menu.workspaces.defaultWorkspace', | 247 | id: 'menu.workspaces.defaultWorkspace', |
245 | defaultMessage: '!!!Default', | 248 | defaultMessage: '!!!Default', |
246 | }, | 249 | }, |
247 | 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 | }, | ||
248 | }); | 262 | }); |
249 | 263 | ||
250 | function getActiveWebview() { | 264 | function getActiveWebview() { |
@@ -353,6 +367,11 @@ const _templateFactory = intl => [ | |||
353 | visible: workspaceStore.isFeatureEnabled, | 367 | visible: workspaceStore.isFeatureEnabled, |
354 | }, | 368 | }, |
355 | { | 369 | { |
370 | label: intl.formatMessage(menuItems.todos), | ||
371 | submenu: [], | ||
372 | visible: todosStore.isFeatureEnabled, | ||
373 | }, | ||
374 | { | ||
356 | label: intl.formatMessage(menuItems.window), | 375 | label: intl.formatMessage(menuItems.window), |
357 | role: 'window', | 376 | role: 'window', |
358 | submenu: [ | 377 | submenu: [ |
@@ -788,6 +807,10 @@ export default class FranzMenu { | |||
788 | tpl[4].submenu = this.workspacesMenu(); | 807 | tpl[4].submenu = this.workspacesMenu(); |
789 | } | 808 | } |
790 | 809 | ||
810 | if (todosStore.isFeatureEnabled) { | ||
811 | tpl[5].submenu = this.todosMenu(); | ||
812 | } | ||
813 | |||
791 | tpl[tpl.length - 1].submenu.push({ | 814 | tpl[tpl.length - 1].submenu.push({ |
792 | type: 'separator', | 815 | type: 'separator', |
793 | }, this.debugMenu()); | 816 | }, this.debugMenu()); |
@@ -902,6 +925,31 @@ export default class FranzMenu { | |||
902 | return menu; | 925 | return menu; |
903 | } | 926 | } |
904 | 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 | |||
905 | debugMenu() { | 953 | debugMenu() { |
906 | const { intl } = window.franz; | 954 | const { intl } = window.franz; |
907 | 955 | ||