diff options
author | Markus Hatvan <markus_hatvan@aon.at> | 2021-09-04 17:03:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-04 17:03:53 +0200 |
commit | f39cbe7d803245702885b308ab1cee4551aea9a1 (patch) | |
tree | 56d2e5dbe6242bb64b03ba5028b8bac39ea0c7ed /src/lib/Menu.js | |
parent | Use namespaces when pulling docker base images since this is reqd for podman (diff) | |
download | ferdium-app-f39cbe7d803245702885b308ab1cee4551aea9a1.tar.gz ferdium-app-f39cbe7d803245702885b308ab1cee4551aea9a1.tar.zst ferdium-app-f39cbe7d803245702885b308ab1cee4551aea9a1.zip |
chore: remove what's new functionality (#1864)
Diffstat (limited to 'src/lib/Menu.js')
-rw-r--r-- | src/lib/Menu.js | 472 |
1 files changed, 277 insertions, 195 deletions
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index 5a99299c5..66447d551 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -2,12 +2,25 @@ import { clipboard } from 'electron'; | |||
2 | import { app, Menu, dialog, systemPreferences } from '@electron/remote'; | 2 | import { app, Menu, dialog, systemPreferences } from '@electron/remote'; |
3 | import { autorun, observable } from 'mobx'; | 3 | import { autorun, observable } from 'mobx'; |
4 | import { defineMessages } from 'react-intl'; | 4 | import { defineMessages } from 'react-intl'; |
5 | import { CUSTOM_WEBSITE_RECIPE_ID, GITHUB_FERDI_URL, LIVE_API_FERDI_WEBSITE } from '../config'; | ||
6 | import { | 5 | import { |
7 | cmdOrCtrlShortcutKey, altKey, shiftKey, settingsShortcutKey, isLinux, isMac, aboutAppDetails, lockFerdiShortcutKey, todosToggleShortcutKey, workspaceToggleShortcutKey, addNewServiceShortcutKey, muteFerdiShortcutKey, | 6 | CUSTOM_WEBSITE_RECIPE_ID, |
7 | GITHUB_FERDI_URL, | ||
8 | LIVE_API_FERDI_WEBSITE, | ||
9 | } from '../config'; | ||
10 | import { | ||
11 | cmdOrCtrlShortcutKey, | ||
12 | altKey, | ||
13 | shiftKey, | ||
14 | settingsShortcutKey, | ||
15 | isLinux, | ||
16 | isMac, | ||
17 | aboutAppDetails, | ||
18 | lockFerdiShortcutKey, | ||
19 | todosToggleShortcutKey, | ||
20 | workspaceToggleShortcutKey, | ||
21 | addNewServiceShortcutKey, | ||
22 | muteFerdiShortcutKey, | ||
8 | } from '../environment'; | 23 | } from '../environment'; |
9 | import { announcementsStore } from '../features/announcements'; | ||
10 | import { announcementActions } from '../features/announcements/actions'; | ||
11 | import { todosStore } from '../features/todos'; | 24 | import { todosStore } from '../features/todos'; |
12 | import { todoActions } from '../features/todos/actions'; | 25 | import { todoActions } from '../features/todos/actions'; |
13 | import { workspaceActions } from '../features/workspaces/actions'; | 26 | import { workspaceActions } from '../features/workspaces/actions'; |
@@ -174,7 +187,8 @@ const menuItems = defineMessages({ | |||
174 | }, | 187 | }, |
175 | debugInfoCopiedBody: { | 188 | debugInfoCopiedBody: { |
176 | id: 'menu.help.debugInfoCopiedBody', | 189 | id: 'menu.help.debugInfoCopiedBody', |
177 | defaultMessage: '!!!Your Debug Information has been copied to your clipboard.', | 190 | defaultMessage: |
191 | '!!!Your Debug Information has been copied to your clipboard.', | ||
178 | }, | 192 | }, |
179 | touchId: { | 193 | touchId: { |
180 | id: 'locked.touchId', | 194 | id: 'locked.touchId', |
@@ -216,10 +230,6 @@ const menuItems = defineMessages({ | |||
216 | id: 'menu.app.about', | 230 | id: 'menu.app.about', |
217 | defaultMessage: '!!!About Ferdi', | 231 | defaultMessage: '!!!About Ferdi', |
218 | }, | 232 | }, |
219 | announcement: { | ||
220 | id: 'menu.app.announcement', | ||
221 | defaultMessage: '!!!What\'s new?', | ||
222 | }, | ||
223 | settings: { | 233 | settings: { |
224 | id: 'menu.app.settings', | 234 | id: 'menu.app.settings', |
225 | defaultMessage: '!!!Settings', | 235 | defaultMessage: '!!!Settings', |
@@ -513,44 +523,49 @@ const _titleBarTemplateFactory = (intl, locked) => [ | |||
513 | submenu: [ | 523 | submenu: [ |
514 | { | 524 | { |
515 | label: intl.formatMessage(menuItems.learnMore), | 525 | label: intl.formatMessage(menuItems.learnMore), |
516 | click() { openExternalUrl(LIVE_API_FERDI_WEBSITE, true); }, | 526 | click() { |
527 | openExternalUrl(LIVE_API_FERDI_WEBSITE, true); | ||
528 | }, | ||
517 | }, | 529 | }, |
518 | { | 530 | { |
519 | label: intl.formatMessage(menuItems.changelog), | 531 | label: intl.formatMessage(menuItems.changelog), |
520 | click() { openExternalUrl(`${GITHUB_FERDI_URL}/ferdi/blob/develop/CHANGELOG.md`, true); }, | 532 | click() { |
533 | openExternalUrl( | ||
534 | `${GITHUB_FERDI_URL}/ferdi/blob/develop/CHANGELOG.md`, | ||
535 | true, | ||
536 | ); | ||
537 | }, | ||
521 | }, | 538 | }, |
522 | { | 539 | { |
523 | label: intl.formatMessage(menuItems.importExportData), | 540 | label: intl.formatMessage(menuItems.importExportData), |
524 | click() { openExternalUrl(apiBase(false), true); }, | 541 | click() { |
525 | enabled: !locked, | 542 | openExternalUrl(apiBase(false), true); |
526 | }, | ||
527 | { | ||
528 | type: 'separator', | ||
529 | }, | ||
530 | { | ||
531 | label: intl.formatMessage(menuItems.announcement), | ||
532 | click: () => { | ||
533 | announcementActions.show(); | ||
534 | }, | 543 | }, |
535 | enabled: !locked && window.ferdi.stores.user.isLoggedIn && announcementsStore.areNewsAvailable, | 544 | enabled: !locked, |
536 | }, | 545 | }, |
537 | { | 546 | { |
538 | type: 'separator', | 547 | type: 'separator', |
539 | }, | 548 | }, |
540 | { | 549 | { |
541 | label: intl.formatMessage(menuItems.support), | 550 | label: intl.formatMessage(menuItems.support), |
542 | click() { openExternalUrl(`${LIVE_API_FERDI_WEBSITE}/contact`, true); }, | 551 | click() { |
552 | openExternalUrl(`${LIVE_API_FERDI_WEBSITE}/contact`, true); | ||
553 | }, | ||
543 | }, | 554 | }, |
544 | { | 555 | { |
545 | type: 'separator', | 556 | type: 'separator', |
546 | }, | 557 | }, |
547 | { | 558 | { |
548 | label: intl.formatMessage(menuItems.tos), | 559 | label: intl.formatMessage(menuItems.tos), |
549 | click() { openExternalUrl(`${termsBase()}/terms`, true); }, | 560 | click() { |
561 | openExternalUrl(`${termsBase()}/terms`, true); | ||
562 | }, | ||
550 | }, | 563 | }, |
551 | { | 564 | { |
552 | label: intl.formatMessage(menuItems.privacy), | 565 | label: intl.formatMessage(menuItems.privacy), |
553 | click() { openExternalUrl(`${termsBase()}/privacy`, true); }, | 566 | click() { |
567 | openExternalUrl(`${termsBase()}/privacy`, true); | ||
568 | }, | ||
554 | }, | 569 | }, |
555 | ], | 570 | ], |
556 | }, | 571 | }, |
@@ -599,7 +614,8 @@ export default class FranzMenu { | |||
599 | window.ferdi.actions.settings.update({ | 614 | window.ferdi.actions.settings.update({ |
600 | type: 'app', | 615 | type: 'app', |
601 | data: { | 616 | data: { |
602 | autohideMenuBar: !window.ferdi.stores.settings.app.autohideMenuBar, | 617 | autohideMenuBar: |
618 | !window.ferdi.stores.settings.app.autohideMenuBar, | ||
603 | }, | 619 | }, |
604 | }); | 620 | }); |
605 | }, | 621 | }, |
@@ -607,22 +623,28 @@ export default class FranzMenu { | |||
607 | } | 623 | } |
608 | 624 | ||
609 | if (!this.stores.settings.app.locked) { | 625 | if (!this.stores.settings.app.locked) { |
610 | tpl[1].submenu.push({ | 626 | tpl[1].submenu.push( |
611 | type: 'separator', | 627 | { |
612 | }, { | 628 | type: 'separator', |
613 | label: intl.formatMessage(menuItems.toggleDevTools), | ||
614 | accelerator: `${cmdOrCtrlShortcutKey()}+${altKey()}+I`, | ||
615 | click: (menuItem, browserWindow) => { | ||
616 | browserWindow.webContents.toggleDevTools(); | ||
617 | }, | 629 | }, |
618 | }, { | 630 | { |
619 | label: intl.formatMessage(menuItems.toggleServiceDevTools), | 631 | label: intl.formatMessage(menuItems.toggleDevTools), |
620 | accelerator: `${cmdOrCtrlShortcutKey()}+${shiftKey()}+${altKey()}+I`, | 632 | accelerator: `${cmdOrCtrlShortcutKey()}+${altKey()}+I`, |
621 | click: () => { | 633 | click: (menuItem, browserWindow) => { |
622 | this.actions.service.openDevToolsForActiveService(); | 634 | browserWindow.webContents.toggleDevTools(); |
635 | }, | ||
623 | }, | 636 | }, |
624 | enabled: this.stores.user.isLoggedIn && this.stores.services.enabled.length > 0, | 637 | { |
625 | }); | 638 | label: intl.formatMessage(menuItems.toggleServiceDevTools), |
639 | accelerator: `${cmdOrCtrlShortcutKey()}+${shiftKey()}+${altKey()}+I`, | ||
640 | click: () => { | ||
641 | this.actions.service.openDevToolsForActiveService(); | ||
642 | }, | ||
643 | enabled: | ||
644 | this.stores.user.isLoggedIn && | ||
645 | this.stores.services.enabled.length > 0, | ||
646 | }, | ||
647 | ); | ||
626 | 648 | ||
627 | if (this.stores.features.features.isTodosEnabled) { | 649 | if (this.stores.features.features.isTodosEnabled) { |
628 | tpl[1].submenu.push({ | 650 | tpl[1].submenu.push({ |
@@ -635,49 +657,62 @@ export default class FranzMenu { | |||
635 | }); | 657 | }); |
636 | } | 658 | } |
637 | 659 | ||
638 | tpl[1].submenu.unshift({ | 660 | tpl[1].submenu.unshift( |
639 | label: intl.formatMessage(menuItems.reloadService), | 661 | { |
640 | id: 'reloadService', // TODO: needed? | 662 | label: intl.formatMessage(menuItems.reloadService), |
641 | accelerator: `${cmdOrCtrlShortcutKey()}+R`, | 663 | id: 'reloadService', // TODO: needed? |
642 | click: () => { | 664 | accelerator: `${cmdOrCtrlShortcutKey()}+R`, |
643 | if (this.stores.user.isLoggedIn | 665 | click: () => { |
644 | && this.stores.services.enabled.length > 0) { | 666 | if ( |
645 | if (this.stores.services.active.recipe.id === CUSTOM_WEBSITE_RECIPE_ID) { | 667 | this.stores.user.isLoggedIn && |
646 | this.stores.services.active.webview.reload(); | 668 | this.stores.services.enabled.length > 0 |
669 | ) { | ||
670 | if ( | ||
671 | this.stores.services.active.recipe.id === | ||
672 | CUSTOM_WEBSITE_RECIPE_ID | ||
673 | ) { | ||
674 | this.stores.services.active.webview.reload(); | ||
675 | } else { | ||
676 | this.actions.service.reloadActive(); | ||
677 | } | ||
647 | } else { | 678 | } else { |
648 | this.actions.service.reloadActive(); | 679 | window.location.reload(); |
649 | } | 680 | } |
650 | } else { | 681 | }, |
682 | }, | ||
683 | { | ||
684 | label: intl.formatMessage(menuItems.reloadFerdi), | ||
685 | accelerator: `${cmdOrCtrlShortcutKey()}+${shiftKey()}+R`, | ||
686 | click: () => { | ||
651 | window.location.reload(); | 687 | window.location.reload(); |
652 | } | 688 | }, |
653 | }, | 689 | }, |
654 | }, { | 690 | { |
655 | label: intl.formatMessage(menuItems.reloadFerdi), | 691 | label: intl.formatMessage(menuItems.reloadTodos), |
656 | accelerator: `${cmdOrCtrlShortcutKey()}+${shiftKey()}+R`, | 692 | accelerator: `${cmdOrCtrlShortcutKey()}+${shiftKey()}+${altKey()}+R`, |
657 | click: () => { | 693 | click: () => { |
658 | window.location.reload(); | 694 | this.actions.todos.reload(); |
695 | }, | ||
659 | }, | 696 | }, |
660 | }, { | 697 | { |
661 | label: intl.formatMessage(menuItems.reloadTodos), | 698 | type: 'separator', |
662 | accelerator: `${cmdOrCtrlShortcutKey()}+${shiftKey()}+${altKey()}+R`, | ||
663 | click: () => { | ||
664 | this.actions.todos.reload(); | ||
665 | }, | 699 | }, |
666 | }, { | 700 | { |
667 | type: 'separator', | 701 | label: intl.formatMessage(menuItems.lockFerdi), |
668 | }, { | 702 | accelerator: `${lockFerdiShortcutKey()}`, |
669 | label: intl.formatMessage(menuItems.lockFerdi), | 703 | enabled: |
670 | accelerator: `${lockFerdiShortcutKey()}`, | 704 | this.stores.user.isLoggedIn && |
671 | enabled: this.stores.user.isLoggedIn && this.stores.settings.app.lockingFeatureEnabled, | 705 | this.stores.settings.app.lockingFeatureEnabled, |
672 | click() { | 706 | click() { |
673 | actions.settings.update({ | 707 | actions.settings.update({ |
674 | type: 'app', | 708 | type: 'app', |
675 | data: { | 709 | data: { |
676 | locked: true, | 710 | locked: true, |
677 | }, | 711 | }, |
678 | }); | 712 | }); |
713 | }, | ||
679 | }, | 714 | }, |
680 | }); | 715 | ); |
681 | 716 | ||
682 | if (serviceTpl.length > 0) { | 717 | if (serviceTpl.length > 0) { |
683 | tpl[2].submenu = serviceTpl; | 718 | tpl[2].submenu = serviceTpl; |
@@ -691,26 +726,34 @@ export default class FranzMenu { | |||
691 | tpl[4].submenu = this.todosMenu(); | 726 | tpl[4].submenu = this.todosMenu(); |
692 | } | 727 | } |
693 | } else { | 728 | } else { |
694 | const touchIdEnabled = isMac ? (this.stores.settings.app.useTouchIdToUnlock && systemPreferences.canPromptTouchID()) : false; | 729 | const touchIdEnabled = isMac |
730 | ? this.stores.settings.app.useTouchIdToUnlock && | ||
731 | systemPreferences.canPromptTouchID() | ||
732 | : false; | ||
695 | 733 | ||
696 | tpl[0].submenu.unshift({ | 734 | tpl[0].submenu.unshift( |
697 | label: intl.formatMessage(menuItems.touchId), | 735 | { |
698 | accelerator: `${lockFerdiShortcutKey()}`, | 736 | label: intl.formatMessage(menuItems.touchId), |
699 | visible: touchIdEnabled, | 737 | accelerator: `${lockFerdiShortcutKey()}`, |
700 | click() { | 738 | visible: touchIdEnabled, |
701 | systemPreferences.promptTouchID(intl.formatMessage(menuItems.touchIdPrompt)).then(() => { | 739 | click() { |
702 | actions.settings.update({ | 740 | systemPreferences |
703 | type: 'app', | 741 | .promptTouchID(intl.formatMessage(menuItems.touchIdPrompt)) |
704 | data: { | 742 | .then(() => { |
705 | locked: false, | 743 | actions.settings.update({ |
706 | }, | 744 | type: 'app', |
707 | }); | 745 | data: { |
708 | }); | 746 | locked: false, |
747 | }, | ||
748 | }); | ||
749 | }); | ||
750 | }, | ||
709 | }, | 751 | }, |
710 | }, { | 752 | { |
711 | type: 'separator', | 753 | type: 'separator', |
712 | visible: touchIdEnabled, | 754 | visible: touchIdEnabled, |
713 | }); | 755 | }, |
756 | ); | ||
714 | } | 757 | } |
715 | 758 | ||
716 | tpl.unshift({ | 759 | tpl.unshift({ |
@@ -838,9 +881,12 @@ export default class FranzMenu { | |||
838 | }, | 881 | }, |
839 | ]; | 882 | ]; |
840 | 883 | ||
841 | tpl[tpl.length - 1].submenu.push({ | 884 | tpl[tpl.length - 1].submenu.push( |
842 | type: 'separator', | 885 | { |
843 | }, about); | 886 | type: 'separator', |
887 | }, | ||
888 | about, | ||
889 | ); | ||
844 | } | 890 | } |
845 | 891 | ||
846 | if (!this.stores.settings.app.locked) { | 892 | if (!this.stores.settings.app.locked) { |
@@ -856,9 +902,12 @@ export default class FranzMenu { | |||
856 | tpl[5].submenu = this.todosMenu(); | 902 | tpl[5].submenu = this.todosMenu(); |
857 | } | 903 | } |
858 | 904 | ||
859 | tpl[tpl.length - 1].submenu.push({ | 905 | tpl[tpl.length - 1].submenu.push( |
860 | type: 'separator', | 906 | { |
861 | }, ...this.debugMenu()); | 907 | type: 'separator', |
908 | }, | ||
909 | ...this.debugMenu(), | ||
910 | ); | ||
862 | } | 911 | } |
863 | this.currentTemplate = tpl; | 912 | this.currentTemplate = tpl; |
864 | const menu = Menu.buildFromTemplate(tpl); | 913 | const menu = Menu.buildFromTemplate(tpl); |
@@ -872,73 +921,95 @@ export default class FranzMenu { | |||
872 | const menu = []; | 921 | const menu = []; |
873 | const cmdAltShortcutsVisibile = !isLinux; | 922 | const cmdAltShortcutsVisibile = !isLinux; |
874 | 923 | ||
875 | menu.push({ | 924 | menu.push( |
876 | label: intl.formatMessage(menuItems.addNewService), | 925 | { |
877 | accelerator: `${addNewServiceShortcutKey()}`, | 926 | label: intl.formatMessage(menuItems.addNewService), |
878 | click: () => { | 927 | accelerator: `${addNewServiceShortcutKey()}`, |
879 | this.actions.ui.openSettings({ path: 'recipes' }); | 928 | click: () => { |
929 | this.actions.ui.openSettings({ path: 'recipes' }); | ||
930 | }, | ||
880 | }, | 931 | }, |
881 | }, { | 932 | { |
882 | type: 'separator', | 933 | type: 'separator', |
883 | }, { | 934 | }, |
884 | label: intl.formatMessage(menuItems.activateNextService), | 935 | { |
885 | accelerator: `${cmdOrCtrlShortcutKey()}+tab`, | 936 | label: intl.formatMessage(menuItems.activateNextService), |
886 | click: () => this.actions.service.setActiveNext(), | 937 | accelerator: `${cmdOrCtrlShortcutKey()}+tab`, |
887 | visible: !cmdAltShortcutsVisibile, | 938 | click: () => this.actions.service.setActiveNext(), |
888 | }, { | 939 | visible: !cmdAltShortcutsVisibile, |
889 | label: intl.formatMessage(menuItems.activateNextService), | 940 | }, |
890 | accelerator: `${cmdOrCtrlShortcutKey()}+${altKey()}+right`, | 941 | { |
891 | click: () => this.actions.service.setActiveNext(), | 942 | label: intl.formatMessage(menuItems.activateNextService), |
892 | visible: cmdAltShortcutsVisibile, | 943 | accelerator: `${cmdOrCtrlShortcutKey()}+${altKey()}+right`, |
893 | }, { | 944 | click: () => this.actions.service.setActiveNext(), |
894 | label: intl.formatMessage(menuItems.activatePreviousService), | 945 | visible: cmdAltShortcutsVisibile, |
895 | accelerator: `${cmdOrCtrlShortcutKey()}+${shiftKey()}+tab`, | 946 | }, |
896 | click: () => this.actions.service.setActivePrev(), | 947 | { |
897 | visible: !cmdAltShortcutsVisibile, | 948 | label: intl.formatMessage(menuItems.activatePreviousService), |
898 | }, { | 949 | accelerator: `${cmdOrCtrlShortcutKey()}+${shiftKey()}+tab`, |
899 | label: intl.formatMessage(menuItems.activatePreviousService), | 950 | click: () => this.actions.service.setActivePrev(), |
900 | accelerator: `${cmdOrCtrlShortcutKey()}+${altKey()}+left`, | 951 | visible: !cmdAltShortcutsVisibile, |
901 | click: () => this.actions.service.setActivePrev(), | 952 | }, |
902 | visible: cmdAltShortcutsVisibile, | 953 | { |
903 | }, { | 954 | label: intl.formatMessage(menuItems.activatePreviousService), |
904 | label: intl.formatMessage( | 955 | accelerator: `${cmdOrCtrlShortcutKey()}+${altKey()}+left`, |
905 | settings.all.app.isAppMuted ? menuItems.unmuteApp : menuItems.muteApp, | 956 | click: () => this.actions.service.setActivePrev(), |
906 | ).replace('&', '&&'), | 957 | visible: cmdAltShortcutsVisibile, |
907 | accelerator: `${muteFerdiShortcutKey()}`, | 958 | }, |
908 | click: () => this.actions.app.toggleMuteApp(), | 959 | { |
909 | }, { | 960 | label: intl |
910 | type: 'separator', | 961 | .formatMessage( |
911 | }); | 962 | settings.all.app.isAppMuted |
912 | 963 | ? menuItems.unmuteApp | |
913 | services.allDisplayed.forEach((service, i) => (menu.push({ | 964 | : menuItems.muteApp, |
914 | label: this._getServiceName(service), | 965 | ) |
915 | accelerator: i < 9 ? `${cmdOrCtrlShortcutKey()}+${i + 1}` : null, | 966 | .replace('&', '&&'), |
916 | type: 'radio', | 967 | accelerator: `${muteFerdiShortcutKey()}`, |
917 | checked: service.isActive, | 968 | click: () => this.actions.app.toggleMuteApp(), |
918 | click: () => { | 969 | }, |
919 | this.actions.service.setActive({ serviceId: service.id }); | 970 | { |
920 | 971 | type: 'separator', | |
921 | if (isMac && i === 0) { | ||
922 | app.mainWindow.restore(); | ||
923 | } | ||
924 | }, | 972 | }, |
925 | }))); | 973 | ); |
926 | 974 | ||
927 | if (services.active && services.active.recipe.id === CUSTOM_WEBSITE_RECIPE_ID) { | 975 | services.allDisplayed.forEach((service, i) => |
928 | menu.push({ | 976 | menu.push({ |
929 | type: 'separator', | 977 | label: this._getServiceName(service), |
930 | }, { | 978 | accelerator: i < 9 ? `${cmdOrCtrlShortcutKey()}+${i + 1}` : null, |
931 | label: intl.formatMessage(menuItems.serviceGoHome), | 979 | type: 'radio', |
932 | accelerator: `${cmdOrCtrlShortcutKey()}+${shiftKey()}+H`, | 980 | checked: service.isActive, |
933 | click: () => this.actions.service.reloadActive(), | 981 | click: () => { |
934 | }); | 982 | this.actions.service.setActive({ serviceId: service.id }); |
983 | |||
984 | if (isMac && i === 0) { | ||
985 | app.mainWindow.restore(); | ||
986 | } | ||
987 | }, | ||
988 | }), | ||
989 | ); | ||
990 | |||
991 | if ( | ||
992 | services.active && | ||
993 | services.active.recipe.id === CUSTOM_WEBSITE_RECIPE_ID | ||
994 | ) { | ||
995 | menu.push( | ||
996 | { | ||
997 | type: 'separator', | ||
998 | }, | ||
999 | { | ||
1000 | label: intl.formatMessage(menuItems.serviceGoHome), | ||
1001 | accelerator: `${cmdOrCtrlShortcutKey()}+${shiftKey()}+H`, | ||
1002 | click: () => this.actions.service.reloadActive(), | ||
1003 | }, | ||
1004 | ); | ||
935 | } | 1005 | } |
936 | 1006 | ||
937 | return menu; | 1007 | return menu; |
938 | } | 1008 | } |
939 | 1009 | ||
940 | workspacesMenu() { | 1010 | workspacesMenu() { |
941 | const { workspaces, activeWorkspace, isWorkspaceDrawerOpen } = workspaceStore; | 1011 | const { workspaces, activeWorkspace, isWorkspaceDrawerOpen } = |
1012 | workspaceStore; | ||
942 | const { intl } = window.ferdi; | 1013 | const { intl } = window.ferdi; |
943 | const menu = []; | 1014 | const menu = []; |
944 | 1015 | ||
@@ -954,9 +1025,9 @@ export default class FranzMenu { | |||
954 | 1025 | ||
955 | // Open workspace drawer: | 1026 | // Open workspace drawer: |
956 | if (!this.stores.settings.app.alwaysShowWorkspaces) { | 1027 | if (!this.stores.settings.app.alwaysShowWorkspaces) { |
957 | const drawerLabel = ( | 1028 | const drawerLabel = isWorkspaceDrawerOpen |
958 | isWorkspaceDrawerOpen ? menuItems.closeWorkspaceDrawer : menuItems.openWorkspaceDrawer | 1029 | ? menuItems.closeWorkspaceDrawer |
959 | ); | 1030 | : menuItems.openWorkspaceDrawer; |
960 | menu.push({ | 1031 | menu.push({ |
961 | label: intl.formatMessage(drawerLabel), | 1032 | label: intl.formatMessage(drawerLabel), |
962 | accelerator: `${workspaceToggleShortcutKey()}`, | 1033 | accelerator: `${workspaceToggleShortcutKey()}`, |
@@ -983,15 +1054,18 @@ export default class FranzMenu { | |||
983 | }); | 1054 | }); |
984 | 1055 | ||
985 | // Workspace items | 1056 | // Workspace items |
986 | workspaces.forEach((workspace, i) => menu.push({ | 1057 | workspaces.forEach((workspace, i) => |
987 | label: workspace.name, | 1058 | menu.push({ |
988 | accelerator: i < 9 ? `${cmdOrCtrlShortcutKey()}+${altKey()}+${i + 1}` : null, | 1059 | label: workspace.name, |
989 | type: 'radio', | 1060 | accelerator: |
990 | checked: activeWorkspace ? workspace.id === activeWorkspace.id : false, | 1061 | i < 9 ? `${cmdOrCtrlShortcutKey()}+${altKey()}+${i + 1}` : null, |
991 | click: () => { | 1062 | type: 'radio', |
992 | workspaceActions.activate({ workspace }); | 1063 | checked: activeWorkspace ? workspace.id === activeWorkspace.id : false, |
993 | }, | 1064 | click: () => { |
994 | })); | 1065 | workspaceActions.activate({ workspace }); |
1066 | }, | ||
1067 | }), | ||
1068 | ); | ||
995 | 1069 | ||
996 | return menu; | 1070 | return menu; |
997 | } | 1071 | } |
@@ -1001,7 +1075,9 @@ export default class FranzMenu { | |||
1001 | const { intl } = window.ferdi; | 1075 | const { intl } = window.ferdi; |
1002 | const menu = []; | 1076 | const menu = []; |
1003 | 1077 | ||
1004 | const drawerLabel = isTodosPanelVisible ? menuItems.closeTodosDrawer : menuItems.openTodosDrawer; | 1078 | const drawerLabel = isTodosPanelVisible |
1079 | ? menuItems.closeTodosDrawer | ||
1080 | : menuItems.openTodosDrawer; | ||
1005 | 1081 | ||
1006 | menu.push({ | 1082 | menu.push({ |
1007 | label: intl.formatMessage(drawerLabel), | 1083 | label: intl.formatMessage(drawerLabel), |
@@ -1013,14 +1089,17 @@ export default class FranzMenu { | |||
1013 | }); | 1089 | }); |
1014 | 1090 | ||
1015 | if (!isFeatureEnabledByUser) { | 1091 | if (!isFeatureEnabledByUser) { |
1016 | menu.push({ | 1092 | menu.push( |
1017 | type: 'separator', | 1093 | { |
1018 | }, { | 1094 | type: 'separator', |
1019 | label: intl.formatMessage(menuItems.enableTodos), | ||
1020 | click: () => { | ||
1021 | todoActions.toggleTodosFeatureVisibility(); | ||
1022 | }, | 1095 | }, |
1023 | }); | 1096 | { |
1097 | label: intl.formatMessage(menuItems.enableTodos), | ||
1098 | click: () => { | ||
1099 | todoActions.toggleTodosFeatureVisibility(); | ||
1100 | }, | ||
1101 | }, | ||
1102 | ); | ||
1024 | } | 1103 | } |
1025 | 1104 | ||
1026 | return menu; | 1105 | return menu; |
@@ -1029,28 +1108,31 @@ export default class FranzMenu { | |||
1029 | debugMenu() { | 1108 | debugMenu() { |
1030 | const { intl } = window.ferdi; | 1109 | const { intl } = window.ferdi; |
1031 | 1110 | ||
1032 | return [{ | 1111 | return [ |
1033 | label: intl.formatMessage(menuItems.debugInfo), | 1112 | { |
1034 | click: () => { | 1113 | label: intl.formatMessage(menuItems.debugInfo), |
1035 | const { debugInfo } = this.stores.app; | 1114 | click: () => { |
1115 | const { debugInfo } = this.stores.app; | ||
1036 | 1116 | ||
1037 | clipboard.write({ | 1117 | clipboard.write({ |
1038 | text: JSON.stringify(debugInfo), | 1118 | text: JSON.stringify(debugInfo), |
1039 | }); | 1119 | }); |
1040 | 1120 | ||
1041 | this.actions.app.notify({ | 1121 | this.actions.app.notify({ |
1042 | title: intl.formatMessage(menuItems.debugInfoCopiedHeadline), | 1122 | title: intl.formatMessage(menuItems.debugInfoCopiedHeadline), |
1043 | options: { | 1123 | options: { |
1044 | body: intl.formatMessage(menuItems.debugInfoCopiedBody), | 1124 | body: intl.formatMessage(menuItems.debugInfoCopiedBody), |
1045 | }, | 1125 | }, |
1046 | }); | 1126 | }); |
1127 | }, | ||
1047 | }, | 1128 | }, |
1048 | }, { | 1129 | { |
1049 | label: intl.formatMessage(menuItems.publishDebugInfo), | 1130 | label: intl.formatMessage(menuItems.publishDebugInfo), |
1050 | click: () => { | 1131 | click: () => { |
1051 | window.ferdi.features.publishDebugInfo.state.isModalVisible = true; | 1132 | window.ferdi.features.publishDebugInfo.state.isModalVisible = true; |
1133 | }, | ||
1052 | }, | 1134 | }, |
1053 | }]; | 1135 | ]; |
1054 | } | 1136 | } |
1055 | 1137 | ||
1056 | _getServiceName(service) { | 1138 | _getServiceName(service) { |