diff options
author | 2019-09-23 22:29:27 +0530 | |
---|---|---|
committer | 2019-09-23 22:29:27 +0530 | |
commit | 4c4021b3633ce725ccab3bb23d1a6a7878b16514 (patch) | |
tree | 9691916b741c4ca537d24a2f278737016f00c946 /src/features/workspaces/components | |
parent | Merge branch 'develop' (diff) | |
download | ferdium-app-4c4021b3633ce725ccab3bb23d1a6a7878b16514.tar.gz ferdium-app-4c4021b3633ce725ccab3bb23d1a6a7878b16514.tar.zst ferdium-app-4c4021b3633ce725ccab3bb23d1a6a7878b16514.zip |
Add tooltip with shortcuts for Workspaces
Diffstat (limited to 'src/features/workspaces/components')
-rw-r--r-- | src/features/workspaces/components/WorkspaceDrawer.js | 4 | ||||
-rw-r--r-- | src/features/workspaces/components/WorkspaceDrawerItem.js | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/features/workspaces/components/WorkspaceDrawer.js b/src/features/workspaces/components/WorkspaceDrawer.js index e7bc0b157..ee6f8416c 100644 --- a/src/features/workspaces/components/WorkspaceDrawer.js +++ b/src/features/workspaces/components/WorkspaceDrawer.js | |||
@@ -204,8 +204,9 @@ class WorkspaceDrawer extends Component { | |||
204 | }} | 204 | }} |
205 | services={getServicesForWorkspace(null)} | 205 | services={getServicesForWorkspace(null)} |
206 | isActive={actualWorkspace == null} | 206 | isActive={actualWorkspace == null} |
207 | shortcutIndex={0} | ||
207 | /> | 208 | /> |
208 | {workspaces.map(workspace => ( | 209 | {workspaces.map((workspace, index) => ( |
209 | <WorkspaceDrawerItem | 210 | <WorkspaceDrawerItem |
210 | key={workspace.id} | 211 | key={workspace.id} |
211 | name={workspace.name} | 212 | name={workspace.name} |
@@ -218,6 +219,7 @@ class WorkspaceDrawer extends Component { | |||
218 | }} | 219 | }} |
219 | onContextMenuEditClick={() => workspaceActions.edit({ workspace })} | 220 | onContextMenuEditClick={() => workspaceActions.edit({ workspace })} |
220 | services={getServicesForWorkspace(workspace)} | 221 | services={getServicesForWorkspace(workspace)} |
222 | shortcutIndex={index + 1} | ||
221 | /> | 223 | /> |
222 | ))} | 224 | ))} |
223 | <div | 225 | <div |
diff --git a/src/features/workspaces/components/WorkspaceDrawerItem.js b/src/features/workspaces/components/WorkspaceDrawerItem.js index 59a2144d3..9292aa87e 100644 --- a/src/features/workspaces/components/WorkspaceDrawerItem.js +++ b/src/features/workspaces/components/WorkspaceDrawerItem.js | |||
@@ -5,6 +5,7 @@ import { observer } from 'mobx-react'; | |||
5 | import injectSheet from 'react-jss'; | 5 | import injectSheet from 'react-jss'; |
6 | import classnames from 'classnames'; | 6 | import classnames from 'classnames'; |
7 | import { defineMessages, intlShape } from 'react-intl'; | 7 | import { defineMessages, intlShape } from 'react-intl'; |
8 | import { ctrlKey } from '../../../environment'; | ||
8 | 9 | ||
9 | const { Menu } = remote; | 10 | const { Menu } = remote; |
10 | 11 | ||
@@ -69,6 +70,7 @@ class WorkspaceDrawerItem extends Component { | |||
69 | onClick: PropTypes.func.isRequired, | 70 | onClick: PropTypes.func.isRequired, |
70 | services: PropTypes.arrayOf(PropTypes.string).isRequired, | 71 | services: PropTypes.arrayOf(PropTypes.string).isRequired, |
71 | onContextMenuEditClick: PropTypes.func, | 72 | onContextMenuEditClick: PropTypes.func, |
73 | shortcutIndex: PropTypes.number.isRequired, | ||
72 | }; | 74 | }; |
73 | 75 | ||
74 | static defaultProps = { | 76 | static defaultProps = { |
@@ -87,6 +89,7 @@ class WorkspaceDrawerItem extends Component { | |||
87 | onClick, | 89 | onClick, |
88 | onContextMenuEditClick, | 90 | onContextMenuEditClick, |
89 | services, | 91 | services, |
92 | shortcutIndex | ||
90 | } = this.props; | 93 | } = this.props; |
91 | const { intl } = this.context; | 94 | const { intl } = this.context; |
92 | 95 | ||
@@ -112,6 +115,7 @@ class WorkspaceDrawerItem extends Component { | |||
112 | onContextMenu={() => ( | 115 | onContextMenu={() => ( |
113 | onContextMenuEditClick && contextMenu.popup(remote.getCurrentWindow()) | 116 | onContextMenuEditClick && contextMenu.popup(remote.getCurrentWindow()) |
114 | )} | 117 | )} |
118 | data-tip={`${shortcutIndex <= 9 ? `(${ctrlKey}+Alt+${shortcutIndex})` : ''}`} | ||
115 | > | 119 | > |
116 | <span | 120 | <span |
117 | className={classnames([ | 121 | className={classnames([ |