diff options
author | 2019-09-13 17:59:46 +0200 | |
---|---|---|
committer | 2019-09-13 17:59:46 +0200 | |
commit | fb095e4984210ec63c5834d6762dec43457dbc57 (patch) | |
tree | a2c8b353313cb363a56722687e110c6f80f4b791 /src/components/layout/Sidebar.js | |
parent | Use ferdi namespace on debugger (diff) | |
parent | Update CHANGELOG.md (diff) | |
download | ferdium-app-fb095e4984210ec63c5834d6762dec43457dbc57.tar.gz ferdium-app-fb095e4984210ec63c5834d6762dec43457dbc57.tar.zst ferdium-app-fb095e4984210ec63c5834d6762dec43457dbc57.zip |
Merge branch 'master' of https://github.com/meetfranz/franz into meetfranz-master
Diffstat (limited to 'src/components/layout/Sidebar.js')
-rw-r--r-- | src/components/layout/Sidebar.js | 106 |
1 files changed, 58 insertions, 48 deletions
diff --git a/src/components/layout/Sidebar.js b/src/components/layout/Sidebar.js index 1bf2554b5..4bc6feb15 100644 --- a/src/components/layout/Sidebar.js +++ b/src/components/layout/Sidebar.js | |||
@@ -8,6 +8,7 @@ import { Link } from 'react-router'; | |||
8 | import Tabbar from '../services/tabs/Tabbar'; | 8 | import Tabbar from '../services/tabs/Tabbar'; |
9 | import { ctrlKey } from '../../environment'; | 9 | import { ctrlKey } from '../../environment'; |
10 | import { workspaceStore } from '../../features/workspaces'; | 10 | import { workspaceStore } from '../../features/workspaces'; |
11 | import { todosStore } from '../../features/todos'; | ||
11 | 12 | ||
12 | const messages = defineMessages({ | 13 | const messages = defineMessages({ |
13 | settings: { | 14 | settings: { |
@@ -34,6 +35,14 @@ const messages = defineMessages({ | |||
34 | id: 'sidebar.closeWorkspaceDrawer', | 35 | id: 'sidebar.closeWorkspaceDrawer', |
35 | defaultMessage: '!!!Close workspace drawer', | 36 | defaultMessage: '!!!Close workspace drawer', |
36 | }, | 37 | }, |
38 | openTodosDrawer: { | ||
39 | id: 'sidebar.openTodosDrawer', | ||
40 | defaultMessage: '!!!Open Franz Todos', | ||
41 | }, | ||
42 | closeTodosDrawer: { | ||
43 | id: 'sidebar.closeTodosDrawer', | ||
44 | defaultMessage: '!!!Close Franz Todos', | ||
45 | }, | ||
37 | }); | 46 | }); |
38 | 47 | ||
39 | export default @observer class Sidebar extends Component { | 48 | export default @observer class Sidebar extends Component { |
@@ -79,6 +88,10 @@ export default @observer class Sidebar extends Component { | |||
79 | toggleWorkspaceDrawer, | 88 | toggleWorkspaceDrawer, |
80 | } = this.props; | 89 | } = this.props; |
81 | const { intl } = this.context; | 90 | const { intl } = this.context; |
91 | const todosToggleMessage = ( | ||
92 | todosStore.isTodosPanelVisible ? messages.closeTodosDrawer : messages.openTodosDrawer | ||
93 | ); | ||
94 | |||
82 | const workspaceToggleMessage = ( | 95 | const workspaceToggleMessage = ( |
83 | isWorkspaceDrawerOpen ? messages.closeWorkspaceDrawer : messages.openWorkspaceDrawer | 96 | isWorkspaceDrawerOpen ? messages.closeWorkspaceDrawer : messages.openWorkspaceDrawer |
84 | ); | 97 | ); |
@@ -91,54 +104,51 @@ export default @observer class Sidebar extends Component { | |||
91 | enableToolTip={() => this.enableToolTip()} | 104 | enableToolTip={() => this.enableToolTip()} |
92 | disableToolTip={() => this.disableToolTip()} | 105 | disableToolTip={() => this.disableToolTip()} |
93 | /> | 106 | /> |
94 | { | 107 | {todosStore.isFeatureEnabled && todosStore.isFeatureEnabledByUser ? ( |
95 | isLoggedIn ? ( | 108 | <button |
96 | <> | 109 | type="button" |
97 | {workspaceStore.isFeatureEnabled ? ( | 110 | onClick={() => { |
98 | <button | 111 | todoActions.toggleTodosPanel(); |
99 | type="button" | 112 | this.updateToolTip(); |
100 | onClick={() => { | 113 | }} |
101 | toggleWorkspaceDrawer(); | 114 | className="sidebar__button sidebar__button--workspaces" |
102 | this.updateToolTip(); | 115 | data-tip={`${intl.formatMessage(todosToggleMessage)} (${ctrlKey}+T)`} |
103 | }} | 116 | > |
104 | className={`sidebar__button sidebar__button--workspaces ${isWorkspaceDrawerOpen ? 'is-active' : ''}`} | 117 | <i className="mdi mdi-check-all" /> |
105 | data-tip={`${intl.formatMessage(workspaceToggleMessage)} (${ctrlKey}+D)`} | 118 | </button> |
106 | > | 119 | ) : null} |
107 | <i className="mdi mdi-view-grid" /> | 120 | {workspaceStore.isFeatureEnabled ? ( |
108 | </button> | 121 | <button |
109 | ) : null} | 122 | type="button" |
110 | 123 | onClick={() => { | |
111 | <button | 124 | toggleWorkspaceDrawer(); |
112 | type="button" | 125 | this.updateToolTip(); |
113 | onClick={() => { | 126 | }} |
114 | toggleMuteApp(); | 127 | className={`sidebar__button sidebar__button--workspaces ${isWorkspaceDrawerOpen ? 'is-active' : ''}`} |
115 | this.updateToolTip(); | 128 | data-tip={`${intl.formatMessage(workspaceToggleMessage)} (${ctrlKey}+D)`} |
116 | }} | 129 | > |
117 | className={`sidebar__button sidebar__button--audio ${isAppMuted ? 'is-muted' : ''}`} | 130 | <i className="mdi mdi-view-grid" /> |
118 | data-tip={`${intl.formatMessage(isAppMuted ? messages.unmute : messages.mute)} (${ctrlKey}+Shift+M)`} | 131 | </button> |
119 | > | 132 | ) : null} |
120 | <i className={`mdi mdi-bell${isAppMuted ? '-off' : ''}`} /> | 133 | <button |
121 | </button> | 134 | type="button" |
122 | <button | 135 | onClick={() => { |
123 | type="button" | 136 | toggleMuteApp(); |
124 | onClick={() => openSettings({ path: 'recipes' })} | 137 | this.updateToolTip(); |
125 | className="sidebar__button sidebar__button--new-service" | 138 | }} |
126 | data-tip={`${intl.formatMessage(messages.addNewService)} (${ctrlKey}+N)`} | 139 | className={`sidebar__button sidebar__button--audio ${isAppMuted ? 'is-muted' : ''}`} |
127 | > | 140 | data-tip={`${intl.formatMessage(isAppMuted ? messages.unmute : messages.mute)} (${ctrlKey}+Shift+M)`} |
128 | <i className="mdi mdi-plus-box" /> | 141 | > |
129 | </button> | 142 | <i className={`mdi mdi-bell${isAppMuted ? '-off' : ''}`} /> |
130 | </> | 143 | </button> |
131 | ) : ( | 144 | <button |
132 | <Link | 145 | type="button" |
133 | to="/auth/welcome" | 146 | onClick={() => openSettings({ path: 'recipes' })} |
134 | className="sidebar__button sidebar__button--new-service" | 147 | className="sidebar__button sidebar__button--new-service" |
135 | data-tip="Login" | 148 | data-tip={`${intl.formatMessage(messages.addNewService)} (${ctrlKey}+N)`} |
136 | > | 149 | > |
137 | <i className="mdi mdi-login-variant" /> | 150 | <i className="mdi mdi-plus-box" /> |
138 | </Link> | 151 | </button> |
139 | ) | ||
140 | } | ||
141 | |||
142 | <button | 152 | <button |
143 | type="button" | 153 | type="button" |
144 | onClick={() => openSettings({ path: 'app' })} | 154 | onClick={() => openSettings({ path: 'app' })} |