diff options
author | 2019-09-11 13:46:00 +0200 | |
---|---|---|
committer | 2019-09-11 13:46:00 +0200 | |
commit | 7ffcf8cf417e76fe1206b945d417095534b3cad8 (patch) | |
tree | 11a24772a516e23d278565cbebc4dc7a44735969 /src/components/layout/Sidebar.js | |
parent | Fix(Todos): Fix Todos Menu (diff) | |
download | ferdium-app-7ffcf8cf417e76fe1206b945d417095534b3cad8.tar.gz ferdium-app-7ffcf8cf417e76fe1206b945d417095534b3cad8.tar.zst ferdium-app-7ffcf8cf417e76fe1206b945d417095534b3cad8.zip |
feat(Todos): Move todos toggle to sidebar
Diffstat (limited to 'src/components/layout/Sidebar.js')
-rw-r--r-- | src/components/layout/Sidebar.js | 28 |
1 files changed, 28 insertions, 0 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'; | |||
8 | import { ctrlKey } from '../../environment'; | 8 | import { ctrlKey } from '../../environment'; |
9 | import { GA_CATEGORY_WORKSPACES, workspaceStore } from '../../features/workspaces'; | 9 | import { GA_CATEGORY_WORKSPACES, workspaceStore } from '../../features/workspaces'; |
10 | import { gaEvent } from '../../lib/analytics'; | 10 | import { gaEvent } from '../../lib/analytics'; |
11 | import { todosStore, GA_CATEGORY_TODOS } from '../../features/todos'; | ||
12 | import todoActions from '../../features/todos/actions'; | ||
11 | 13 | ||
12 | const messages = defineMessages({ | 14 | const 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 | ||
39 | export default @observer class Sidebar extends Component { | 49 | export 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" |