aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Ricardo Cino <ricardo@cino.io>2022-06-25 02:18:59 +0200
committerLibravatar GitHub <noreply@github.com>2022-06-25 05:48:59 +0530
commit30afc7bd062398aebe2cf6e0d4b2cd3861f7deac (patch)
treeee5444635db88acf5518ab045eefb8b83522a15e /src
parentAdd split mode toggle to side bar and hide collapse button (diff)
downloadferdium-app-30afc7bd062398aebe2cf6e0d4b2cd3861f7deac.tar.gz
ferdium-app-30afc7bd062398aebe2cf6e0d4b2cd3861f7deac.tar.zst
ferdium-app-30afc7bd062398aebe2cf6e0d4b2cd3861f7deac.zip
chore: improve todo menu behaviour on fresh install (#359)
Diffstat (limited to 'src')
-rw-r--r--src/I18n.tsx2
-rw-r--r--src/features/todos/store.js4
-rw-r--r--src/lib/Menu.js50
3 files changed, 34 insertions, 22 deletions
diff --git a/src/I18n.tsx b/src/I18n.tsx
index bf4b08cd1..f5e157d97 100644
--- a/src/I18n.tsx
+++ b/src/I18n.tsx
@@ -11,7 +11,7 @@ const translations = generatedTranslations();
11type Props = { 11type Props = {
12 stores: { 12 stores: {
13 app: AppStore; 13 app: AppStore;
14 user: typeof UserStore; 14 user: UserStore;
15 }; 15 };
16 children: ReactNode; 16 children: ReactNode;
17}; 17};
diff --git a/src/features/todos/store.js b/src/features/todos/store.js
index e5a26ae04..b5228191c 100644
--- a/src/features/todos/store.js
+++ b/src/features/todos/store.js
@@ -206,8 +206,10 @@ export default class TodoStore extends FeatureStore {
206 @action _toggleTodosFeatureVisibility = () => { 206 @action _toggleTodosFeatureVisibility = () => {
207 debug('_toggleTodosFeatureVisibility'); 207 debug('_toggleTodosFeatureVisibility');
208 208
209 const isFeatureEnabled = !this.settings.isFeatureEnabledByUser;
209 this._updateSettings({ 210 this._updateSettings({
210 isFeatureEnabledByUser: !this.settings.isFeatureEnabledByUser, 211 isFeatureEnabledByUser: isFeatureEnabled,
212 isTodosPanelVisible: isFeatureEnabled,
211 }); 213 });
212 }; 214 };
213 215
diff --git a/src/lib/Menu.js b/src/lib/Menu.js
index 54c8c0b77..d3a3163b9 100644
--- a/src/lib/Menu.js
+++ b/src/lib/Menu.js
@@ -473,15 +473,18 @@ const _titleBarTemplateFactory = (intl, locked) => [
473 accelerator: `${cmdOrCtrlShortcutKey()}+B`, 473 accelerator: `${cmdOrCtrlShortcutKey()}+B`,
474 role: 'toggleNavigationBar', 474 role: 'toggleNavigationBar',
475 type: 'checkbox', 475 type: 'checkbox',
476 checked: window['ferdium'].stores.settings.app.navigationBarManualActive, 476 checked:
477 window['ferdium'].stores.settings.app.navigationBarManualActive,
477 click: () => { 478 click: () => {
478 window['ferdium'].actions.settings.update({ 479 window['ferdium'].actions.settings.update({
479 type: 'app', 480 type: 'app',
480 data: { 481 data: {
481 navigationBarManualActive: !window['ferdium'].stores.settings.app.navigationBarManualActive, 482 navigationBarManualActive:
482 } 483 !window['ferdium'].stores.settings.app
484 .navigationBarManualActive,
485 },
483 }); 486 });
484 } 487 },
485 }, 488 },
486 { 489 {
487 label: intl.formatMessage(menuItems.splitModeToggle), 490 label: intl.formatMessage(menuItems.splitModeToggle),
@@ -494,9 +497,9 @@ const _titleBarTemplateFactory = (intl, locked) => [
494 type: 'app', 497 type: 'app',
495 data: { 498 data: {
496 splitMode: !window['ferdium'].stores.settings.app.splitMode, 499 splitMode: !window['ferdium'].stores.settings.app.splitMode,
497 } 500 },
498 }); 501 });
499 } 502 },
500 }, 503 },
501 { 504 {
502 label: intl.formatMessage(menuItems.toggleDarkMode), 505 label: intl.formatMessage(menuItems.toggleDarkMode),
@@ -631,9 +634,10 @@ class FranzMenu {
631 } 634 }
632 635
633 const { intl } = window['ferdium']; 636 const { intl } = window['ferdium'];
634 const locked = this.stores.settings.app.locked 637 const locked =
635 && this.stores.settings.app.lockingFeatureEnabled 638 this.stores.settings.app.locked &&
636 && this.stores.user.isLoggedIn; 639 this.stores.settings.app.lockingFeatureEnabled &&
640 this.stores.user.isLoggedIn;
637 const tpl = _titleBarTemplateFactory(intl, locked); 641 const tpl = _titleBarTemplateFactory(intl, locked);
638 const { actions } = this; 642 const { actions } = this;
639 643
@@ -664,8 +668,9 @@ class FranzMenu {
664 accelerator: `${cmdOrCtrlShortcutKey()}+${altKey()}+I`, 668 accelerator: `${cmdOrCtrlShortcutKey()}+${altKey()}+I`,
665 click: () => { 669 click: () => {
666 const windowWebContents = webContents.fromId(1); 670 const windowWebContents = webContents.fromId(1);
667 const { isDevToolsOpened, openDevTools, closeDevTools } = windowWebContents; 671 const { isDevToolsOpened, openDevTools, closeDevTools } =
668 672 windowWebContents;
673
669 if (isDevToolsOpened()) { 674 if (isDevToolsOpened()) {
670 closeDevTools(); 675 closeDevTools();
671 } else { 676 } else {
@@ -1105,14 +1110,16 @@ class FranzMenu {
1105 ? menuItems.closeTodosDrawer 1110 ? menuItems.closeTodosDrawer
1106 : menuItems.openTodosDrawer; 1111 : menuItems.openTodosDrawer;
1107 1112
1108 menu.push({ 1113 if (isFeatureEnabledByUser) {
1109 label: intl.formatMessage(drawerLabel), 1114 menu.push({
1110 accelerator: `${todosToggleShortcutKey()}`, 1115 label: intl.formatMessage(drawerLabel),
1111 click: () => { 1116 accelerator: `${todosToggleShortcutKey()}`,
1112 todoActions.toggleTodosPanel(); 1117 click: () => {
1113 }, 1118 todoActions.toggleTodosPanel();
1114 enabled: this.stores.user.isLoggedIn && isFeatureEnabledByUser, 1119 },
1115 }); 1120 enabled: this.stores.user.isLoggedIn && isFeatureEnabledByUser,
1121 });
1122 }
1116 1123
1117 if (!isFeatureEnabledByUser) { 1124 if (!isFeatureEnabledByUser) {
1118 menu.push( 1125 menu.push(
@@ -1124,6 +1131,7 @@ class FranzMenu {
1124 click: () => { 1131 click: () => {
1125 todoActions.toggleTodosFeatureVisibility(); 1132 todoActions.toggleTodosFeatureVisibility();
1126 }, 1133 },
1134 enabled: this.stores.user.isLoggedIn,
1127 }, 1135 },
1128 ); 1136 );
1129 } 1137 }
@@ -1155,7 +1163,9 @@ class FranzMenu {
1155 { 1163 {
1156 label: intl.formatMessage(menuItems.publishDebugInfo), 1164 label: intl.formatMessage(menuItems.publishDebugInfo),
1157 click: () => { 1165 click: () => {
1158 window['ferdium'].features.publishDebugInfo.state.isModalVisible = true; 1166 window[
1167 'ferdium'
1168 ].features.publishDebugInfo.state.isModalVisible = true;
1159 }, 1169 },
1160 }, 1170 },
1161 ]; 1171 ];