aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2019-09-11 13:46:00 +0200
committerLibravatar Stefan Malzner <stefan@adlk.io>2019-09-11 13:46:00 +0200
commit7ffcf8cf417e76fe1206b945d417095534b3cad8 (patch)
tree11a24772a516e23d278565cbebc4dc7a44735969
parentFix(Todos): Fix Todos Menu (diff)
downloadferdium-app-7ffcf8cf417e76fe1206b945d417095534b3cad8.tar.gz
ferdium-app-7ffcf8cf417e76fe1206b945d417095534b3cad8.tar.zst
ferdium-app-7ffcf8cf417e76fe1206b945d417095534b3cad8.zip
feat(Todos): Move todos toggle to sidebar
-rw-r--r--src/components/layout/Sidebar.js28
-rw-r--r--src/features/todos/components/TodosWebview.js53
-rw-r--r--src/i18n/locales/defaultMessages.json50
-rw-r--r--src/i18n/locales/en-US.json6
-rw-r--r--src/i18n/messages/src/components/layout/Sidebar.json50
5 files changed, 108 insertions, 79 deletions
diff --git a/src/components/layout/Sidebar.js b/src/components/layout/Sidebar.js
index 36c1f2e39..128f94959 100644
--- a/src/components/layout/Sidebar.js
+++ b/src/components/layout/Sidebar.js
@@ -8,6 +8,8 @@ import Tabbar from '../services/tabs/Tabbar';
8import { ctrlKey } from '../../environment'; 8import { ctrlKey } from '../../environment';
9import { GA_CATEGORY_WORKSPACES, workspaceStore } from '../../features/workspaces'; 9import { GA_CATEGORY_WORKSPACES, workspaceStore } from '../../features/workspaces';
10import { gaEvent } from '../../lib/analytics'; 10import { gaEvent } from '../../lib/analytics';
11import { todosStore, GA_CATEGORY_TODOS } from '../../features/todos';
12import todoActions from '../../features/todos/actions';
11 13
12const messages = defineMessages({ 14const messages = defineMessages({
13 settings: { 15 settings: {
@@ -34,6 +36,14 @@ const messages = defineMessages({
34 id: 'sidebar.closeWorkspaceDrawer', 36 id: 'sidebar.closeWorkspaceDrawer',
35 defaultMessage: '!!!Close workspace drawer', 37 defaultMessage: '!!!Close workspace drawer',
36 }, 38 },
39 openTodosDrawer: {
40 id: 'sidebar.openTodosDrawer',
41 defaultMessage: '!!!Open Franz Todos',
42 },
43 closeTodosDrawer: {
44 id: 'sidebar.closeTodosDrawer',
45 defaultMessage: '!!!Close Franz Todos',
46 },
37}); 47});
38 48
39export default @observer class Sidebar extends Component { 49export default @observer class Sidebar extends Component {
@@ -79,6 +89,10 @@ export default @observer class Sidebar extends Component {
79 toggleWorkspaceDrawer, 89 toggleWorkspaceDrawer,
80 } = this.props; 90 } = this.props;
81 const { intl } = this.context; 91 const { intl } = this.context;
92 const todosToggleMessage = (
93 todosStore.isTodosPanelVisible ? messages.closeTodosDrawer : messages.openTodosDrawer
94 );
95
82 const workspaceToggleMessage = ( 96 const workspaceToggleMessage = (
83 isWorkspaceDrawerOpen ? messages.closeWorkspaceDrawer : messages.openWorkspaceDrawer 97 isWorkspaceDrawerOpen ? messages.closeWorkspaceDrawer : messages.openWorkspaceDrawer
84 ); 98 );
@@ -90,6 +104,20 @@ export default @observer class Sidebar extends Component {
90 enableToolTip={() => this.enableToolTip()} 104 enableToolTip={() => this.enableToolTip()}
91 disableToolTip={() => this.disableToolTip()} 105 disableToolTip={() => this.disableToolTip()}
92 /> 106 />
107 {todosStore.isFeatureEnabled && todosStore.isFeatureEnabledByUser ? (
108 <button
109 type="button"
110 onClick={() => {
111 todoActions.toggleTodosPanel();
112 this.updateToolTip();
113 gaEvent(GA_CATEGORY_TODOS, 'toggleDrawer', 'sidebar');
114 }}
115 className="sidebar__button sidebar__button--workspaces"
116 data-tip={`${intl.formatMessage(todosToggleMessage)} (${ctrlKey}+T)`}
117 >
118 <i className="mdi mdi-check-all" />
119 </button>
120 ) : null}
93 {workspaceStore.isFeatureEnabled ? ( 121 {workspaceStore.isFeatureEnabled ? (
94 <button 122 <button
95 type="button" 123 type="button"
diff --git a/src/features/todos/components/TodosWebview.js b/src/features/todos/components/TodosWebview.js
index c06183e37..aed1a8834 100644
--- a/src/features/todos/components/TodosWebview.js
+++ b/src/features/todos/components/TodosWebview.js
@@ -61,50 +61,6 @@ const styles = theme => ({
61 background: theme.todos.dragIndicator.background, 61 background: theme.todos.dragIndicator.background,
62 62
63 }, 63 },
64 openTodosButton: {
65 width: OPEN_TODOS_BUTTON_SIZE,
66 height: OPEN_TODOS_BUTTON_SIZE,
67 background: theme.todos.toggleButton.background,
68 position: 'absolute',
69 bottom: 120,
70 right: props => (props.width + (props.isVisible ? -OPEN_TODOS_BUTTON_SIZE / 2 : 0)),
71 borderRadius: OPEN_TODOS_BUTTON_SIZE / 2,
72 opacity: props => (props.isVisible ? 0 : 1),
73 transition: 'right 0.5s',
74 zIndex: 600,
75 display: 'flex',
76 alignItems: 'center',
77 justifyContent: 'center',
78 boxShadow: [0, 0, 10, theme.todos.toggleButton.shadowColor],
79
80 borderTopRightRadius: props => (props.isVisible ? null : 0),
81 borderBottomRightRadius: props => (props.isVisible ? null : 0),
82
83 '& svg': {
84 fill: theme.todos.toggleButton.textColor,
85 transition: 'all 0.5s',
86 },
87 },
88 closeTodosButton: {
89 width: CLOSE_TODOS_BUTTON_SIZE,
90 height: CLOSE_TODOS_BUTTON_SIZE,
91 background: theme.todos.toggleButton.background,
92 position: 'absolute',
93 bottom: 120,
94 right: ({ width }) => (width + -CLOSE_TODOS_BUTTON_SIZE / 2),
95 borderRadius: CLOSE_TODOS_BUTTON_SIZE / 2,
96 opacity: ({ isTodosIncludedInCurrentPlan }) => (!isTodosIncludedInCurrentPlan ? 1 : 0),
97 transition: 'opacity 0.5s',
98 zIndex: 600,
99 display: 'flex',
100 alignItems: 'center',
101 justifyContent: 'center',
102 boxShadow: [0, 0, 10, theme.todos.toggleButton.shadowColor],
103
104 '& svg': {
105 fill: theme.todos.toggleButton.textColor,
106 },
107 },
108 premiumContainer: { 64 premiumContainer: {
109 display: 'flex', 65 display: 'flex',
110 flexDirection: 'column', 66 flexDirection: 'column',
@@ -132,7 +88,6 @@ class TodosWebview extends Component {
132 static propTypes = { 88 static propTypes = {
133 classes: PropTypes.object.isRequired, 89 classes: PropTypes.object.isRequired,
134 isVisible: PropTypes.bool.isRequired, 90 isVisible: PropTypes.bool.isRequired,
135 togglePanel: PropTypes.func.isRequired,
136 handleClientMessage: PropTypes.func.isRequired, 91 handleClientMessage: PropTypes.func.isRequired,
137 setTodosWebview: PropTypes.func.isRequired, 92 setTodosWebview: PropTypes.func.isRequired,
138 resize: PropTypes.func.isRequired, 93 resize: PropTypes.func.isRequired,
@@ -228,7 +183,6 @@ class TodosWebview extends Component {
228 const { 183 const {
229 classes, 184 classes,
230 isVisible, 185 isVisible,
231 togglePanel,
232 isTodosIncludedInCurrentPlan, 186 isTodosIncludedInCurrentPlan,
233 } = this.props; 187 } = this.props;
234 188
@@ -247,13 +201,6 @@ class TodosWebview extends Component {
247 onMouseUp={() => this.stopResize()} 201 onMouseUp={() => this.stopResize()}
248 ref={(node) => { this.node = node; }} 202 ref={(node) => { this.node = node; }}
249 > 203 >
250 <button
251 onClick={() => togglePanel()}
252 className={isVisible ? classes.closeTodosButton : classes.openTodosButton}
253 type="button"
254 >
255 <Icon icon={isVisible ? mdiChevronRight : mdiCheckAll} size={2} />
256 </button>
257 <div 204 <div
258 className={classes.resizeHandler} 205 className={classes.resizeHandler}
259 style={Object.assign({ left: delta }, isDragging ? { width: 600, marginLeft: -200 } : {})} // This hack is required as resizing with webviews beneath behaves quite bad 206 style={Object.assign({ left: delta }, isDragging ? { width: 600, marginLeft: -200 } : {})} // This hack is required as resizing with webviews beneath behaves quite bad
diff --git a/src/i18n/locales/defaultMessages.json b/src/i18n/locales/defaultMessages.json
index fe09fea46..f2293ead2 100644
--- a/src/i18n/locales/defaultMessages.json
+++ b/src/i18n/locales/defaultMessages.json
@@ -765,78 +765,104 @@
765 "defaultMessage": "!!!Settings", 765 "defaultMessage": "!!!Settings",
766 "end": { 766 "end": {
767 "column": 3, 767 "column": 3,
768 "line": 16 768 "line": 18
769 }, 769 },
770 "file": "src/components/layout/Sidebar.js", 770 "file": "src/components/layout/Sidebar.js",
771 "id": "sidebar.settings", 771 "id": "sidebar.settings",
772 "start": { 772 "start": {
773 "column": 12, 773 "column": 12,
774 "line": 13 774 "line": 15
775 } 775 }
776 }, 776 },
777 { 777 {
778 "defaultMessage": "!!!Add new service", 778 "defaultMessage": "!!!Add new service",
779 "end": { 779 "end": {
780 "column": 3, 780 "column": 3,
781 "line": 20 781 "line": 22
782 }, 782 },
783 "file": "src/components/layout/Sidebar.js", 783 "file": "src/components/layout/Sidebar.js",
784 "id": "sidebar.addNewService", 784 "id": "sidebar.addNewService",
785 "start": { 785 "start": {
786 "column": 17, 786 "column": 17,
787 "line": 17 787 "line": 19
788 } 788 }
789 }, 789 },
790 { 790 {
791 "defaultMessage": "!!!Disable notifications & audio", 791 "defaultMessage": "!!!Disable notifications & audio",
792 "end": { 792 "end": {
793 "column": 3, 793 "column": 3,
794 "line": 24 794 "line": 26
795 }, 795 },
796 "file": "src/components/layout/Sidebar.js", 796 "file": "src/components/layout/Sidebar.js",
797 "id": "sidebar.muteApp", 797 "id": "sidebar.muteApp",
798 "start": { 798 "start": {
799 "column": 8, 799 "column": 8,
800 "line": 21 800 "line": 23
801 } 801 }
802 }, 802 },
803 { 803 {
804 "defaultMessage": "!!!Enable notifications & audio", 804 "defaultMessage": "!!!Enable notifications & audio",
805 "end": { 805 "end": {
806 "column": 3, 806 "column": 3,
807 "line": 28 807 "line": 30
808 }, 808 },
809 "file": "src/components/layout/Sidebar.js", 809 "file": "src/components/layout/Sidebar.js",
810 "id": "sidebar.unmuteApp", 810 "id": "sidebar.unmuteApp",
811 "start": { 811 "start": {
812 "column": 10, 812 "column": 10,
813 "line": 25 813 "line": 27
814 } 814 }
815 }, 815 },
816 { 816 {
817 "defaultMessage": "!!!Open workspace drawer", 817 "defaultMessage": "!!!Open workspace drawer",
818 "end": { 818 "end": {
819 "column": 3, 819 "column": 3,
820 "line": 32 820 "line": 34
821 }, 821 },
822 "file": "src/components/layout/Sidebar.js", 822 "file": "src/components/layout/Sidebar.js",
823 "id": "sidebar.openWorkspaceDrawer", 823 "id": "sidebar.openWorkspaceDrawer",
824 "start": { 824 "start": {
825 "column": 23, 825 "column": 23,
826 "line": 29 826 "line": 31
827 } 827 }
828 }, 828 },
829 { 829 {
830 "defaultMessage": "!!!Close workspace drawer", 830 "defaultMessage": "!!!Close workspace drawer",
831 "end": { 831 "end": {
832 "column": 3, 832 "column": 3,
833 "line": 36 833 "line": 38
834 }, 834 },
835 "file": "src/components/layout/Sidebar.js", 835 "file": "src/components/layout/Sidebar.js",
836 "id": "sidebar.closeWorkspaceDrawer", 836 "id": "sidebar.closeWorkspaceDrawer",
837 "start": { 837 "start": {
838 "column": 24, 838 "column": 24,
839 "line": 33 839 "line": 35
840 }
841 },
842 {
843 "defaultMessage": "!!!Open Franz Todos",
844 "end": {
845 "column": 3,
846 "line": 42
847 },
848 "file": "src/components/layout/Sidebar.js",
849 "id": "sidebar.openTodosDrawer",
850 "start": {
851 "column": 19,
852 "line": 39
853 }
854 },
855 {
856 "defaultMessage": "!!!Close Franz Todos",
857 "end": {
858 "column": 3,
859 "line": 46
860 },
861 "file": "src/components/layout/Sidebar.js",
862 "id": "sidebar.closeTodosDrawer",
863 "start": {
864 "column": 20,
865 "line": 43
840 } 866 }
841 } 867 }
842 ], 868 ],
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json
index 609076e88..e9f2c9cc1 100644
--- a/src/i18n/locales/en-US.json
+++ b/src/i18n/locales/en-US.json
@@ -93,7 +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.todos.enableTodos": "Enable Todos",
97 "menu.view": "View", 97 "menu.view": "View",
98 "menu.view.enterFullScreen": "Enter Full Screen", 98 "menu.view.enterFullScreen": "Enter Full Screen",
99 "menu.view.exitFullScreen": "Exit Full Screen", 99 "menu.view.exitFullScreen": "Exit Full Screen",
@@ -329,8 +329,10 @@
329 "settings.workspaces.workspaceFeatureInfo": "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. 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.", 329 "settings.workspaces.workspaceFeatureInfo": "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. 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.",
330 "settings.workspaces.workspacesRequestFailed": "Could not load your workspaces", 330 "settings.workspaces.workspacesRequestFailed": "Could not load your workspaces",
331 "sidebar.addNewService": "Add new service", 331 "sidebar.addNewService": "Add new service",
332 "sidebar.closeTodosDrawer": "Close Franz Todos",
332 "sidebar.closeWorkspaceDrawer": "Close workspace drawer", 333 "sidebar.closeWorkspaceDrawer": "Close workspace drawer",
333 "sidebar.muteApp": "Disable notifications & audio", 334 "sidebar.muteApp": "Disable notifications & audio",
335 "sidebar.openTodosDrawer": "Open Franz Todos",
334 "sidebar.openWorkspaceDrawer": "Open workspace drawer", 336 "sidebar.openWorkspaceDrawer": "Open workspace drawer",
335 "sidebar.settings": "Settings", 337 "sidebar.settings": "Settings",
336 "sidebar.unmuteApp": "Enable notifications & audio", 338 "sidebar.unmuteApp": "Enable notifications & audio",
@@ -380,4 +382,4 @@
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>", 382 "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>",
381 "workspaceDrawer.workspacesSettingsTooltip": "Edit workspaces settings", 383 "workspaceDrawer.workspacesSettingsTooltip": "Edit workspaces settings",
382 "workspaces.switchingIndicator.switchingTo": "Switching to" 384 "workspaces.switchingIndicator.switchingTo": "Switching to"
383} \ No newline at end of file 385}
diff --git a/src/i18n/messages/src/components/layout/Sidebar.json b/src/i18n/messages/src/components/layout/Sidebar.json
index d67adc96e..837dc54bc 100644
--- a/src/i18n/messages/src/components/layout/Sidebar.json
+++ b/src/i18n/messages/src/components/layout/Sidebar.json
@@ -4,11 +4,11 @@
4 "defaultMessage": "!!!Settings", 4 "defaultMessage": "!!!Settings",
5 "file": "src/components/layout/Sidebar.js", 5 "file": "src/components/layout/Sidebar.js",
6 "start": { 6 "start": {
7 "line": 13, 7 "line": 15,
8 "column": 12 8 "column": 12
9 }, 9 },
10 "end": { 10 "end": {
11 "line": 16, 11 "line": 18,
12 "column": 3 12 "column": 3
13 } 13 }
14 }, 14 },
@@ -17,11 +17,11 @@
17 "defaultMessage": "!!!Add new service", 17 "defaultMessage": "!!!Add new service",
18 "file": "src/components/layout/Sidebar.js", 18 "file": "src/components/layout/Sidebar.js",
19 "start": { 19 "start": {
20 "line": 17, 20 "line": 19,
21 "column": 17 21 "column": 17
22 }, 22 },
23 "end": { 23 "end": {
24 "line": 20, 24 "line": 22,
25 "column": 3 25 "column": 3
26 } 26 }
27 }, 27 },
@@ -30,11 +30,11 @@
30 "defaultMessage": "!!!Disable notifications & audio", 30 "defaultMessage": "!!!Disable notifications & audio",
31 "file": "src/components/layout/Sidebar.js", 31 "file": "src/components/layout/Sidebar.js",
32 "start": { 32 "start": {
33 "line": 21, 33 "line": 23,
34 "column": 8 34 "column": 8
35 }, 35 },
36 "end": { 36 "end": {
37 "line": 24, 37 "line": 26,
38 "column": 3 38 "column": 3
39 } 39 }
40 }, 40 },
@@ -43,11 +43,11 @@
43 "defaultMessage": "!!!Enable notifications & audio", 43 "defaultMessage": "!!!Enable notifications & audio",
44 "file": "src/components/layout/Sidebar.js", 44 "file": "src/components/layout/Sidebar.js",
45 "start": { 45 "start": {
46 "line": 25, 46 "line": 27,
47 "column": 10 47 "column": 10
48 }, 48 },
49 "end": { 49 "end": {
50 "line": 28, 50 "line": 30,
51 "column": 3 51 "column": 3
52 } 52 }
53 }, 53 },
@@ -56,11 +56,11 @@
56 "defaultMessage": "!!!Open workspace drawer", 56 "defaultMessage": "!!!Open workspace drawer",
57 "file": "src/components/layout/Sidebar.js", 57 "file": "src/components/layout/Sidebar.js",
58 "start": { 58 "start": {
59 "line": 29, 59 "line": 31,
60 "column": 23 60 "column": 23
61 }, 61 },
62 "end": { 62 "end": {
63 "line": 32, 63 "line": 34,
64 "column": 3 64 "column": 3
65 } 65 }
66 }, 66 },
@@ -69,11 +69,37 @@
69 "defaultMessage": "!!!Close workspace drawer", 69 "defaultMessage": "!!!Close workspace drawer",
70 "file": "src/components/layout/Sidebar.js", 70 "file": "src/components/layout/Sidebar.js",
71 "start": { 71 "start": {
72 "line": 33, 72 "line": 35,
73 "column": 24 73 "column": 24
74 }, 74 },
75 "end": { 75 "end": {
76 "line": 36, 76 "line": 38,
77 "column": 3
78 }
79 },
80 {
81 "id": "sidebar.openTodosDrawer",
82 "defaultMessage": "!!!Open Franz Todos",
83 "file": "src/components/layout/Sidebar.js",
84 "start": {
85 "line": 39,
86 "column": 19
87 },
88 "end": {
89 "line": 42,
90 "column": 3
91 }
92 },
93 {
94 "id": "sidebar.closeTodosDrawer",
95 "defaultMessage": "!!!Close Franz Todos",
96 "file": "src/components/layout/Sidebar.js",
97 "start": {
98 "line": 43,
99 "column": 20
100 },
101 "end": {
102 "line": 46,
77 "column": 3 103 "column": 3
78 } 104 }
79 } 105 }