aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2019-09-11 11:03:39 +0200
committerLibravatar Stefan Malzner <stefan@adlk.io>2019-09-11 11:03:39 +0200
commit0f2fe50e811531945ab6dfe67f604c9eddbb6239 (patch)
treefe8ca79d25083071573e4b986366b2cfafa77095
parentfix(Settings): Don't toggle Todos on general settings changes (diff)
downloadferdium-app-0f2fe50e811531945ab6dfe67f604c9eddbb6239.tar.gz
ferdium-app-0f2fe50e811531945ab6dfe67f604c9eddbb6239.tar.zst
ferdium-app-0f2fe50e811531945ab6dfe67f604c9eddbb6239.zip
Fix(Todos): Fix Todos Menu
-rw-r--r--src/features/todos/store.js6
-rw-r--r--src/i18n/locales/defaultMessages.json13
-rw-r--r--src/i18n/locales/en-US.json3
-rw-r--r--src/i18n/messages/src/lib/Menu.json13
-rw-r--r--src/lib/Menu.js24
5 files changed, 51 insertions, 8 deletions
diff --git a/src/features/todos/store.js b/src/features/todos/store.js
index 05eef4ec1..abf176604 100644
--- a/src/features/todos/store.js
+++ b/src/features/todos/store.js
@@ -33,7 +33,7 @@ export default class TodoStore extends FeatureStore {
33 33
34 @computed get isTodosPanelForceHidden() { 34 @computed get isTodosPanelForceHidden() {
35 const { isAnnouncementShown } = this.stores.announcements; 35 const { isAnnouncementShown } = this.stores.announcements;
36 return delayAppState.isDelayAppScreenVisible || !this.settings.isFeatureEnabledByUser || isAnnouncementShown; 36 return delayAppState.isDelayAppScreenVisible || !this.isFeatureEnabledByUser || isAnnouncementShown;
37 } 37 }
38 38
39 @computed get isTodosPanelVisible() { 39 @computed get isTodosPanelVisible() {
@@ -41,6 +41,10 @@ export default class TodoStore extends FeatureStore {
41 return this.settings.isTodosPanelVisible; 41 return this.settings.isTodosPanelVisible;
42 } 42 }
43 43
44 @computed get isFeatureEnabledByUser() {
45 return this.settings.isFeatureEnabledByUser;
46 }
47
44 @computed get settings() { 48 @computed get settings() {
45 return localStorage.getItem('todos') || {}; 49 return localStorage.getItem('todos') || {};
46 } 50 }
diff --git a/src/i18n/locales/defaultMessages.json b/src/i18n/locales/defaultMessages.json
index 44a49317e..fe09fea46 100644
--- a/src/i18n/locales/defaultMessages.json
+++ b/src/i18n/locales/defaultMessages.json
@@ -5475,6 +5475,19 @@
5475 "column": 20, 5475 "column": 20,
5476 "line": 258 5476 "line": 258
5477 } 5477 }
5478 },
5479 {
5480 "defaultMessage": "!!!Enable Todos",
5481 "end": {
5482 "column": 3,
5483 "line": 265
5484 },
5485 "file": "src/lib/Menu.js",
5486 "id": "menu.todos.enableTodos",
5487 "start": {
5488 "column": 15,
5489 "line": 262
5490 }
5478 } 5491 }
5479 ], 5492 ],
5480 "path": "src/lib/Menu.json" 5493 "path": "src/lib/Menu.json"
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json
index 9e63fdbca..609076e88 100644
--- a/src/i18n/locales/en-US.json
+++ b/src/i18n/locales/en-US.json
@@ -93,6 +93,7 @@
93 "menu.services.addNewService": "Add New Service...", 93 "menu.services.addNewService": "Add New Service...",
94 "menu.services.setNextServiceActive": "Activate next service", 94 "menu.services.setNextServiceActive": "Activate next service",
95 "menu.todos": "Todos", 95 "menu.todos": "Todos",
96 "menu.todos.enableTodos": "!!!Enable Todos",
96 "menu.view": "View", 97 "menu.view": "View",
97 "menu.view.enterFullScreen": "Enter Full Screen", 98 "menu.view.enterFullScreen": "Enter Full Screen",
98 "menu.view.exitFullScreen": "Exit Full Screen", 99 "menu.view.exitFullScreen": "Exit Full Screen",
@@ -379,4 +380,4 @@
379 "workspaceDrawer.workspaceFeatureInfo": "<p>Franz Workspaces let you focus on what’s important right now. Set up different sets of services and easily switch between them at any time.</p><p>You decide which services you need when and where, so we can help you stay on top of your game - or easily switch off from work whenever you want.</p>", 380 "workspaceDrawer.workspaceFeatureInfo": "<p>Franz Workspaces let you focus on what’s important right now. Set up different sets of services and easily switch between them at any time.</p><p>You decide which services you need when and where, so we can help you stay on top of your game - or easily switch off from work whenever you want.</p>",
380 "workspaceDrawer.workspacesSettingsTooltip": "Edit workspaces settings", 381 "workspaceDrawer.workspacesSettingsTooltip": "Edit workspaces settings",
381 "workspaces.switchingIndicator.switchingTo": "Switching to" 382 "workspaces.switchingIndicator.switchingTo": "Switching to"
382} 383} \ No newline at end of file
diff --git a/src/i18n/messages/src/lib/Menu.json b/src/i18n/messages/src/lib/Menu.json
index cee46608c..0c0cab33f 100644
--- a/src/i18n/messages/src/lib/Menu.json
+++ b/src/i18n/messages/src/lib/Menu.json
@@ -791,5 +791,18 @@
791 "line": 261, 791 "line": 261,
792 "column": 3 792 "column": 3
793 } 793 }
794 },
795 {
796 "id": "menu.todos.enableTodos",
797 "defaultMessage": "!!!Enable Todos",
798 "file": "src/lib/Menu.js",
799 "start": {
800 "line": 262,
801 "column": 15
802 },
803 "end": {
804 "line": 265,
805 "column": 3
806 }
794 } 807 }
795] \ No newline at end of file 808] \ No newline at end of file
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
264function getActiveWebview() { 268function 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