diff options
5 files changed, 62 insertions, 5 deletions
diff --git a/src/features/workspaces/components/WorkspaceDrawer.js b/src/features/workspaces/components/WorkspaceDrawer.js index 64c98dc63..684e50dd0 100644 --- a/src/features/workspaces/components/WorkspaceDrawer.js +++ b/src/features/workspaces/components/WorkspaceDrawer.js | |||
@@ -215,6 +215,7 @@ class WorkspaceDrawer extends Component { | |||
215 | workspaceActions.toggleWorkspaceDrawer(); | 215 | workspaceActions.toggleWorkspaceDrawer(); |
216 | gaEvent(GA_CATEGORY_WORKSPACES, 'switch', 'drawer'); | 216 | gaEvent(GA_CATEGORY_WORKSPACES, 'switch', 'drawer'); |
217 | }} | 217 | }} |
218 | onContextMenuEditClick={() => workspaceActions.edit({ workspace })} | ||
218 | services={getServicesForWorkspace(workspace)} | 219 | services={getServicesForWorkspace(workspace)} |
219 | /> | 220 | /> |
220 | ))} | 221 | ))} |
diff --git a/src/features/workspaces/components/WorkspaceDrawerItem.js b/src/features/workspaces/components/WorkspaceDrawerItem.js index 57f0754d9..59a2144d3 100644 --- a/src/features/workspaces/components/WorkspaceDrawerItem.js +++ b/src/features/workspaces/components/WorkspaceDrawerItem.js | |||
@@ -1,3 +1,4 @@ | |||
1 | import { remote } from 'electron'; | ||
1 | import React, { Component } from 'react'; | 2 | import React, { Component } from 'react'; |
2 | import PropTypes from 'prop-types'; | 3 | import PropTypes from 'prop-types'; |
3 | import { observer } from 'mobx-react'; | 4 | import { observer } from 'mobx-react'; |
@@ -5,11 +6,17 @@ import injectSheet from 'react-jss'; | |||
5 | import classnames from 'classnames'; | 6 | import classnames from 'classnames'; |
6 | import { defineMessages, intlShape } from 'react-intl'; | 7 | import { defineMessages, intlShape } from 'react-intl'; |
7 | 8 | ||
9 | const { Menu } = remote; | ||
10 | |||
8 | const messages = defineMessages({ | 11 | const messages = defineMessages({ |
9 | noServicesAddedYet: { | 12 | noServicesAddedYet: { |
10 | id: 'workspaceDrawer.item.noServicesAddedYet', | 13 | id: 'workspaceDrawer.item.noServicesAddedYet', |
11 | defaultMessage: '!!!No services added yet', | 14 | defaultMessage: '!!!No services added yet', |
12 | }, | 15 | }, |
16 | contextMenuEdit: { | ||
17 | id: 'workspaceDrawer.item.contextMenuEdit', | ||
18 | defaultMessage: '!!!edit', | ||
19 | }, | ||
13 | }); | 20 | }); |
14 | 21 | ||
15 | const styles = theme => ({ | 22 | const styles = theme => ({ |
@@ -61,6 +68,11 @@ class WorkspaceDrawerItem extends Component { | |||
61 | name: PropTypes.string.isRequired, | 68 | name: PropTypes.string.isRequired, |
62 | onClick: PropTypes.func.isRequired, | 69 | onClick: PropTypes.func.isRequired, |
63 | services: PropTypes.arrayOf(PropTypes.string).isRequired, | 70 | services: PropTypes.arrayOf(PropTypes.string).isRequired, |
71 | onContextMenuEditClick: PropTypes.func, | ||
72 | }; | ||
73 | |||
74 | static defaultProps = { | ||
75 | onContextMenuEditClick: null, | ||
64 | }; | 76 | }; |
65 | 77 | ||
66 | static contextTypes = { | 78 | static contextTypes = { |
@@ -73,9 +85,23 @@ class WorkspaceDrawerItem extends Component { | |||
73 | isActive, | 85 | isActive, |
74 | name, | 86 | name, |
75 | onClick, | 87 | onClick, |
88 | onContextMenuEditClick, | ||
76 | services, | 89 | services, |
77 | } = this.props; | 90 | } = this.props; |
78 | const { intl } = this.context; | 91 | const { intl } = this.context; |
92 | |||
93 | const contextMenuTemplate = [{ | ||
94 | label: name, | ||
95 | enabled: false, | ||
96 | }, { | ||
97 | type: 'separator', | ||
98 | }, { | ||
99 | label: intl.formatMessage(messages.contextMenuEdit), | ||
100 | click: onContextMenuEditClick, | ||
101 | }]; | ||
102 | |||
103 | const contextMenu = Menu.buildFromTemplate(contextMenuTemplate); | ||
104 | |||
79 | return ( | 105 | return ( |
80 | <div | 106 | <div |
81 | className={classnames([ | 107 | className={classnames([ |
@@ -83,6 +109,9 @@ class WorkspaceDrawerItem extends Component { | |||
83 | isActive ? classes.isActiveItem : null, | 109 | isActive ? classes.isActiveItem : null, |
84 | ])} | 110 | ])} |
85 | onClick={onClick} | 111 | onClick={onClick} |
112 | onContextMenu={() => ( | ||
113 | onContextMenuEditClick && contextMenu.popup(remote.getCurrentWindow()) | ||
114 | )} | ||
86 | > | 115 | > |
87 | <span | 116 | <span |
88 | className={classnames([ | 117 | className={classnames([ |
diff --git a/src/i18n/locales/defaultMessages.json b/src/i18n/locales/defaultMessages.json index 11a23805c..65799b614 100644 --- a/src/i18n/locales/defaultMessages.json +++ b/src/i18n/locales/defaultMessages.json | |||
@@ -3435,13 +3435,26 @@ | |||
3435 | "defaultMessage": "!!!No services added yet", | 3435 | "defaultMessage": "!!!No services added yet", |
3436 | "end": { | 3436 | "end": { |
3437 | "column": 3, | 3437 | "column": 3, |
3438 | "line": 12 | 3438 | "line": 15 |
3439 | }, | 3439 | }, |
3440 | "file": "src/features/workspaces/components/WorkspaceDrawerItem.js", | 3440 | "file": "src/features/workspaces/components/WorkspaceDrawerItem.js", |
3441 | "id": "workspaceDrawer.item.noServicesAddedYet", | 3441 | "id": "workspaceDrawer.item.noServicesAddedYet", |
3442 | "start": { | 3442 | "start": { |
3443 | "column": 22, | 3443 | "column": 22, |
3444 | "line": 9 | 3444 | "line": 12 |
3445 | } | ||
3446 | }, | ||
3447 | { | ||
3448 | "defaultMessage": "!!!edit", | ||
3449 | "end": { | ||
3450 | "column": 3, | ||
3451 | "line": 19 | ||
3452 | }, | ||
3453 | "file": "src/features/workspaces/components/WorkspaceDrawerItem.js", | ||
3454 | "id": "workspaceDrawer.item.contextMenuEdit", | ||
3455 | "start": { | ||
3456 | "column": 19, | ||
3457 | "line": 16 | ||
3445 | } | 3458 | } |
3446 | } | 3459 | } |
3447 | ], | 3460 | ], |
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index a2f460f67..da7649b90 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json | |||
@@ -309,6 +309,7 @@ | |||
309 | "workspaceDrawer.addNewWorkspaceLabel": "Add new workspace", | 309 | "workspaceDrawer.addNewWorkspaceLabel": "Add new workspace", |
310 | "workspaceDrawer.allServices": "All services", | 310 | "workspaceDrawer.allServices": "All services", |
311 | "workspaceDrawer.headline": "Workspaces", | 311 | "workspaceDrawer.headline": "Workspaces", |
312 | "workspaceDrawer.item.contextMenuEdit": "edit", | ||
312 | "workspaceDrawer.item.noServicesAddedYet": "No services added yet", | 313 | "workspaceDrawer.item.noServicesAddedYet": "No services added yet", |
313 | "workspaceDrawer.premiumCtaButtonLabel": "Create your first workspace", | 314 | "workspaceDrawer.premiumCtaButtonLabel": "Create your first workspace", |
314 | "workspaceDrawer.proFeatureBadge": "Premium feature", | 315 | "workspaceDrawer.proFeatureBadge": "Premium feature", |
@@ -316,4 +317,4 @@ | |||
316 | "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>", | 317 | "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>", |
317 | "workspaceDrawer.workspacesSettingsTooltip": "Edit workspaces settings", | 318 | "workspaceDrawer.workspacesSettingsTooltip": "Edit workspaces settings", |
318 | "workspaces.switchingIndicator.switchingTo": "Switching to" | 319 | "workspaces.switchingIndicator.switchingTo": "Switching to" |
319 | } \ No newline at end of file | 320 | } |
diff --git a/src/i18n/messages/src/features/workspaces/components/WorkspaceDrawerItem.json b/src/i18n/messages/src/features/workspaces/components/WorkspaceDrawerItem.json index cdbd1d5b5..4ff190606 100644 --- a/src/i18n/messages/src/features/workspaces/components/WorkspaceDrawerItem.json +++ b/src/i18n/messages/src/features/workspaces/components/WorkspaceDrawerItem.json | |||
@@ -4,11 +4,24 @@ | |||
4 | "defaultMessage": "!!!No services added yet", | 4 | "defaultMessage": "!!!No services added yet", |
5 | "file": "src/features/workspaces/components/WorkspaceDrawerItem.js", | 5 | "file": "src/features/workspaces/components/WorkspaceDrawerItem.js", |
6 | "start": { | 6 | "start": { |
7 | "line": 9, | 7 | "line": 12, |
8 | "column": 22 | 8 | "column": 22 |
9 | }, | 9 | }, |
10 | "end": { | 10 | "end": { |
11 | "line": 12, | 11 | "line": 15, |
12 | "column": 3 | ||
13 | } | ||
14 | }, | ||
15 | { | ||
16 | "id": "workspaceDrawer.item.contextMenuEdit", | ||
17 | "defaultMessage": "!!!edit", | ||
18 | "file": "src/features/workspaces/components/WorkspaceDrawerItem.js", | ||
19 | "start": { | ||
20 | "line": 16, | ||
21 | "column": 19 | ||
22 | }, | ||
23 | "end": { | ||
24 | "line": 19, | ||
12 | "column": 3 | 25 | "column": 3 |
13 | } | 26 | } |
14 | } | 27 | } |