diff options
author | 2019-09-11 11:03:39 +0200 | |
---|---|---|
committer | 2019-09-11 11:03:39 +0200 | |
commit | 0f2fe50e811531945ab6dfe67f604c9eddbb6239 (patch) | |
tree | fe8ca79d25083071573e4b986366b2cfafa77095 /src/lib | |
parent | fix(Settings): Don't toggle Todos on general settings changes (diff) | |
download | ferdium-app-0f2fe50e811531945ab6dfe67f604c9eddbb6239.tar.gz ferdium-app-0f2fe50e811531945ab6dfe67f604c9eddbb6239.tar.zst ferdium-app-0f2fe50e811531945ab6dfe67f604c9eddbb6239.zip |
Fix(Todos): Fix Todos Menu
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Menu.js | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index 81efaf18f..6ffa007f2 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -259,6 +259,10 @@ const menuItems = defineMessages({ | |||
259 | id: 'menu.Todoss.closeTodosDrawer', | 259 | id: 'menu.Todoss.closeTodosDrawer', |
260 | defaultMessage: '!!!Close Todos drawer', | 260 | defaultMessage: '!!!Close Todos drawer', |
261 | }, | 261 | }, |
262 | enableTodos: { | ||
263 | id: 'menu.todos.enableTodos', | ||
264 | defaultMessage: '!!!Enable Todos', | ||
265 | }, | ||
262 | }); | 266 | }); |
263 | 267 | ||
264 | function getActiveWebview() { | 268 | function getActiveWebview() { |
@@ -926,14 +930,12 @@ export default class FranzMenu { | |||
926 | } | 930 | } |
927 | 931 | ||
928 | todosMenu() { | 932 | todosMenu() { |
929 | const { isTodosPanelVisible } = TodoStore; | 933 | const { isTodosPanelVisible, isFeatureEnabledByUser } = this.stores.todos; |
930 | const { intl } = window.franz; | 934 | const { intl } = window.franz; |
931 | const menu = []; | 935 | const menu = []; |
932 | 936 | ||
933 | // Open todos drawer: | 937 | const drawerLabel = isTodosPanelVisible ? menuItems.closeTodosDrawer : menuItems.openTodosDrawer; |
934 | const drawerLabel = ( | 938 | |
935 | isTodosPanelVisible ? menuItems.closeTodosDrawer : menuItems.openTodosDrawer | ||
936 | ); | ||
937 | menu.push({ | 939 | menu.push({ |
938 | label: intl.formatMessage(drawerLabel), | 940 | label: intl.formatMessage(drawerLabel), |
939 | accelerator: `${cmdKey}+T`, | 941 | accelerator: `${cmdKey}+T`, |
@@ -941,11 +943,21 @@ export default class FranzMenu { | |||
941 | todoActions.toggleTodosPanel(); | 943 | todoActions.toggleTodosPanel(); |
942 | gaEvent(GA_CATEGORY_TODOS, 'toggleDrawer', 'menu'); | 944 | gaEvent(GA_CATEGORY_TODOS, 'toggleDrawer', 'menu'); |
943 | }, | 945 | }, |
944 | enabled: this.stores.user.isLoggedIn, | 946 | enabled: this.stores.user.isLoggedIn && isFeatureEnabledByUser, |
945 | }, { | 947 | }, { |
946 | type: 'separator', | 948 | type: 'separator', |
947 | }); | 949 | }); |
948 | 950 | ||
951 | if (!isFeatureEnabledByUser) { | ||
952 | menu.push({ | ||
953 | label: intl.formatMessage(menuItems.enableTodos), | ||
954 | click: () => { | ||
955 | todoActions.toggleTodosFeatureVisibility(); | ||
956 | gaEvent(GA_CATEGORY_TODOS, 'enable', 'menu'); | ||
957 | }, | ||
958 | }); | ||
959 | } | ||
960 | |||
949 | return menu; | 961 | return menu; |
950 | } | 962 | } |
951 | 963 | ||