diff options
author | 2021-09-13 14:45:46 +0200 | |
---|---|---|
committer | 2021-09-13 14:45:46 +0200 | |
commit | 537697a6e9757f118d09d9e76362ba1ff617e2c6 (patch) | |
tree | bc55447115e385137684e84697a8c15d2199b8d5 /src/features/workspaces/components | |
parent | Bumped up version to: 5.6.3-nightly.0 [skip ci] (diff) | |
download | ferdium-app-537697a6e9757f118d09d9e76362ba1ff617e2c6.tar.gz ferdium-app-537697a6e9757f118d09d9e76362ba1ff617e2c6.tar.zst ferdium-app-537697a6e9757f118d09d9e76362ba1ff617e2c6.zip |
chore: upgrade intl dependencies (#1920)
Diffstat (limited to 'src/features/workspaces/components')
7 files changed, 78 insertions, 104 deletions
diff --git a/src/features/workspaces/components/CreateWorkspaceForm.js b/src/features/workspaces/components/CreateWorkspaceForm.js index 15b97121d..c9b05b87f 100644 --- a/src/features/workspaces/components/CreateWorkspaceForm.js +++ b/src/features/workspaces/components/CreateWorkspaceForm.js | |||
@@ -1,7 +1,7 @@ | |||
1 | import React, { Component } from 'react'; | 1 | import React, { Component } from 'react'; |
2 | import PropTypes from 'prop-types'; | 2 | import PropTypes from 'prop-types'; |
3 | import { observer } from 'mobx-react'; | 3 | import { observer } from 'mobx-react'; |
4 | import { defineMessages, intlShape } from 'react-intl'; | 4 | import { defineMessages, injectIntl } from 'react-intl'; |
5 | import { Input, Button } from '@meetfranz/forms'; | 5 | import { Input, Button } from '@meetfranz/forms'; |
6 | import injectSheet from 'react-jss'; | 6 | import injectSheet from 'react-jss'; |
7 | import Form from '../../../lib/Form'; | 7 | import Form from '../../../lib/Form'; |
@@ -11,11 +11,11 @@ import { workspaceStore } from '../index'; | |||
11 | const messages = defineMessages({ | 11 | const messages = defineMessages({ |
12 | submitButton: { | 12 | submitButton: { |
13 | id: 'settings.workspace.add.form.submitButton', | 13 | id: 'settings.workspace.add.form.submitButton', |
14 | defaultMessage: '!!!Create workspace', | 14 | defaultMessage: 'Create workspace', |
15 | }, | 15 | }, |
16 | name: { | 16 | name: { |
17 | id: 'settings.workspace.add.form.name', | 17 | id: 'settings.workspace.add.form.name', |
18 | defaultMessage: '!!!Name', | 18 | defaultMessage: 'Name', |
19 | }, | 19 | }, |
20 | }); | 20 | }); |
21 | 21 | ||
@@ -32,12 +32,9 @@ const styles = () => ({ | |||
32 | }, | 32 | }, |
33 | }); | 33 | }); |
34 | 34 | ||
35 | @injectSheet(styles) @observer | 35 | @injectSheet(styles) |
36 | @observer | ||
36 | class CreateWorkspaceForm extends Component { | 37 | class CreateWorkspaceForm extends Component { |
37 | static contextTypes = { | ||
38 | intl: intlShape, | ||
39 | }; | ||
40 | |||
41 | static propTypes = { | 38 | static propTypes = { |
42 | classes: PropTypes.object.isRequired, | 39 | classes: PropTypes.object.isRequired, |
43 | isSubmitting: PropTypes.bool.isRequired, | 40 | isSubmitting: PropTypes.bool.isRequired, |
@@ -45,7 +42,7 @@ class CreateWorkspaceForm extends Component { | |||
45 | }; | 42 | }; |
46 | 43 | ||
47 | form = (() => { | 44 | form = (() => { |
48 | const { intl } = this.context; | 45 | const { intl } = this.props; |
49 | return new Form({ | 46 | return new Form({ |
50 | fields: { | 47 | fields: { |
51 | name: { | 48 | name: { |
@@ -61,7 +58,7 @@ class CreateWorkspaceForm extends Component { | |||
61 | submitForm() { | 58 | submitForm() { |
62 | const { form } = this; | 59 | const { form } = this; |
63 | form.submit({ | 60 | form.submit({ |
64 | onSuccess: async (f) => { | 61 | onSuccess: async f => { |
65 | const { onSubmit } = this.props; | 62 | const { onSubmit } = this.props; |
66 | const values = f.values(); | 63 | const values = f.values(); |
67 | onSubmit(values); | 64 | onSubmit(values); |
@@ -70,7 +67,7 @@ class CreateWorkspaceForm extends Component { | |||
70 | } | 67 | } |
71 | 68 | ||
72 | render() { | 69 | render() { |
73 | const { intl } = this.context; | 70 | const { intl } = this.props; |
74 | const { classes, isSubmitting } = this.props; | 71 | const { classes, isSubmitting } = this.props; |
75 | const { form } = this; | 72 | const { form } = this; |
76 | return ( | 73 | return ( |
@@ -95,4 +92,4 @@ class CreateWorkspaceForm extends Component { | |||
95 | } | 92 | } |
96 | } | 93 | } |
97 | 94 | ||
98 | export default CreateWorkspaceForm; | 95 | export default injectIntl(CreateWorkspaceForm); |
diff --git a/src/features/workspaces/components/EditWorkspaceForm.js b/src/features/workspaces/components/EditWorkspaceForm.js index c97d4bd9c..cae95e9ed 100644 --- a/src/features/workspaces/components/EditWorkspaceForm.js +++ b/src/features/workspaces/components/EditWorkspaceForm.js | |||
@@ -1,7 +1,7 @@ | |||
1 | import React, { Component, Fragment } from 'react'; | 1 | import React, { Component, Fragment } from 'react'; |
2 | import PropTypes from 'prop-types'; | 2 | import PropTypes from 'prop-types'; |
3 | import { observer } from 'mobx-react'; | 3 | import { observer } from 'mobx-react'; |
4 | import { defineMessages, intlShape } from 'react-intl'; | 4 | import { defineMessages, injectIntl } from 'react-intl'; |
5 | import { Link } from 'react-router'; | 5 | import { Link } from 'react-router'; |
6 | import { Input, Button } from '@meetfranz/forms'; | 6 | import { Input, Button } from '@meetfranz/forms'; |
7 | import injectSheet from 'react-jss'; | 7 | import injectSheet from 'react-jss'; |
@@ -20,40 +20,40 @@ import Toggle from '../../../components/ui/Toggle'; | |||
20 | const messages = defineMessages({ | 20 | const messages = defineMessages({ |
21 | buttonDelete: { | 21 | buttonDelete: { |
22 | id: 'settings.workspace.form.buttonDelete', | 22 | id: 'settings.workspace.form.buttonDelete', |
23 | defaultMessage: '!!!Delete workspace', | 23 | defaultMessage: 'Delete workspace', |
24 | }, | 24 | }, |
25 | buttonSave: { | 25 | buttonSave: { |
26 | id: 'settings.workspace.form.buttonSave', | 26 | id: 'settings.workspace.form.buttonSave', |
27 | defaultMessage: '!!!Save workspace', | 27 | defaultMessage: 'Save workspace', |
28 | }, | 28 | }, |
29 | name: { | 29 | name: { |
30 | id: 'settings.workspace.form.name', | 30 | id: 'settings.workspace.form.name', |
31 | defaultMessage: '!!!Name', | 31 | defaultMessage: 'Name', |
32 | }, | 32 | }, |
33 | yourWorkspaces: { | 33 | yourWorkspaces: { |
34 | id: 'settings.workspace.form.yourWorkspaces', | 34 | id: 'settings.workspace.form.yourWorkspaces', |
35 | defaultMessage: '!!!Your workspaces', | 35 | defaultMessage: 'Your workspaces', |
36 | }, | 36 | }, |
37 | keepLoaded: { | 37 | keepLoaded: { |
38 | id: 'settings.workspace.form.keepLoaded', | 38 | id: 'settings.workspace.form.keepLoaded', |
39 | defaultMessage: '!!!Keep this workspace loaded*', | 39 | defaultMessage: 'Keep this workspace loaded*', |
40 | }, | 40 | }, |
41 | keepLoadedInfo: { | 41 | keepLoadedInfo: { |
42 | id: 'settings.workspace.form.keepLoadedInfo', | 42 | id: 'settings.workspace.form.keepLoadedInfo', |
43 | defaultMessage: | 43 | defaultMessage: |
44 | '!!!*This option will be overwritten by the global "Keep all workspaces loaded" option.', | 44 | '*This option will be overwritten by the global "Keep all workspaces loaded" option.', |
45 | }, | 45 | }, |
46 | servicesInWorkspaceHeadline: { | 46 | servicesInWorkspaceHeadline: { |
47 | id: 'settings.workspace.form.servicesInWorkspaceHeadline', | 47 | id: 'settings.workspace.form.servicesInWorkspaceHeadline', |
48 | defaultMessage: '!!!Services in this Workspace', | 48 | defaultMessage: 'Services in this Workspace', |
49 | }, | 49 | }, |
50 | noServicesAdded: { | 50 | noServicesAdded: { |
51 | id: 'settings.services.noServicesAdded', | 51 | id: 'settings.services.noServicesAdded', |
52 | defaultMessage: '!!!Start by adding a service.', | 52 | defaultMessage: 'Start by adding a service.', |
53 | }, | 53 | }, |
54 | discoverServices: { | 54 | discoverServices: { |
55 | id: 'settings.services.discoverServices', | 55 | id: 'settings.services.discoverServices', |
56 | defaultMessage: '!!!Discover services', | 56 | defaultMessage: 'Discover services', |
57 | }, | 57 | }, |
58 | }); | 58 | }); |
59 | 59 | ||
@@ -72,10 +72,6 @@ const styles = () => ({ | |||
72 | @injectSheet(styles) | 72 | @injectSheet(styles) |
73 | @observer | 73 | @observer |
74 | class EditWorkspaceForm extends Component { | 74 | class EditWorkspaceForm extends Component { |
75 | static contextTypes = { | ||
76 | intl: intlShape, | ||
77 | }; | ||
78 | |||
79 | static propTypes = { | 75 | static propTypes = { |
80 | classes: PropTypes.object.isRequired, | 76 | classes: PropTypes.object.isRequired, |
81 | onDelete: PropTypes.func.isRequired, | 77 | onDelete: PropTypes.func.isRequired, |
@@ -97,7 +93,7 @@ class EditWorkspaceForm extends Component { | |||
97 | } | 93 | } |
98 | 94 | ||
99 | prepareWorkspaceForm(workspace) { | 95 | prepareWorkspaceForm(workspace) { |
100 | const { intl } = this.context; | 96 | const { intl } = this.props; |
101 | return new Form({ | 97 | return new Form({ |
102 | fields: { | 98 | fields: { |
103 | name: { | 99 | name: { |
@@ -120,7 +116,7 @@ class EditWorkspaceForm extends Component { | |||
120 | 116 | ||
121 | save(form) { | 117 | save(form) { |
122 | form.submit({ | 118 | form.submit({ |
123 | onSuccess: async (f) => { | 119 | onSuccess: async f => { |
124 | const { onSave } = this.props; | 120 | const { onSave } = this.props; |
125 | const values = f.values(); | 121 | const values = f.values(); |
126 | onSave(values); | 122 | onSave(values); |
@@ -146,7 +142,7 @@ class EditWorkspaceForm extends Component { | |||
146 | } | 142 | } |
147 | 143 | ||
148 | render() { | 144 | render() { |
149 | const { intl } = this.context; | 145 | const { intl } = this.props; |
150 | const { | 146 | const { |
151 | classes, | 147 | classes, |
152 | workspace, | 148 | workspace, |
@@ -194,7 +190,7 @@ class EditWorkspaceForm extends Component { | |||
194 | </div> | 190 | </div> |
195 | ) : ( | 191 | ) : ( |
196 | <> | 192 | <> |
197 | {services.map((s) => ( | 193 | {services.map(s => ( |
198 | <WorkspaceServiceListItem | 194 | <WorkspaceServiceListItem |
199 | key={s.id} | 195 | key={s.id} |
200 | service={s} | 196 | service={s} |
@@ -233,4 +229,4 @@ class EditWorkspaceForm extends Component { | |||
233 | } | 229 | } |
234 | } | 230 | } |
235 | 231 | ||
236 | export default EditWorkspaceForm; | 232 | export default injectIntl(EditWorkspaceForm); |
diff --git a/src/features/workspaces/components/WorkspaceDrawer.js b/src/features/workspaces/components/WorkspaceDrawer.js index 1138f23d7..03a829a64 100644 --- a/src/features/workspaces/components/WorkspaceDrawer.js +++ b/src/features/workspaces/components/WorkspaceDrawer.js | |||
@@ -2,7 +2,7 @@ import React, { Component } from 'react'; | |||
2 | import PropTypes from 'prop-types'; | 2 | import PropTypes from 'prop-types'; |
3 | import { observer } from 'mobx-react'; | 3 | import { observer } from 'mobx-react'; |
4 | import injectSheet from 'react-jss'; | 4 | import injectSheet from 'react-jss'; |
5 | import { defineMessages, intlShape } from 'react-intl'; | 5 | import { defineMessages, injectIntl } from 'react-intl'; |
6 | import { H1, Icon } from '@meetfranz/ui'; | 6 | import { H1, Icon } from '@meetfranz/ui'; |
7 | import ReactTooltip from 'react-tooltip'; | 7 | import ReactTooltip from 'react-tooltip'; |
8 | 8 | ||
@@ -14,27 +14,27 @@ import { workspaceStore } from '../index'; | |||
14 | const messages = defineMessages({ | 14 | const messages = defineMessages({ |
15 | headline: { | 15 | headline: { |
16 | id: 'workspaceDrawer.headline', | 16 | id: 'workspaceDrawer.headline', |
17 | defaultMessage: '!!!Workspaces', | 17 | defaultMessage: 'Workspaces', |
18 | }, | 18 | }, |
19 | allServices: { | 19 | allServices: { |
20 | id: 'workspaceDrawer.allServices', | 20 | id: 'workspaceDrawer.allServices', |
21 | defaultMessage: '!!!All services', | 21 | defaultMessage: 'All services', |
22 | }, | 22 | }, |
23 | workspacesSettingsTooltip: { | 23 | workspacesSettingsTooltip: { |
24 | id: 'workspaceDrawer.workspacesSettingsTooltip', | 24 | id: 'workspaceDrawer.workspacesSettingsTooltip', |
25 | defaultMessage: '!!!Workspaces settings', | 25 | defaultMessage: 'Workspaces settings', |
26 | }, | 26 | }, |
27 | workspaceFeatureInfo: { | 27 | workspaceFeatureInfo: { |
28 | id: 'workspaceDrawer.workspaceFeatureInfo', | 28 | id: 'workspaceDrawer.workspaceFeatureInfo', |
29 | defaultMessage: '!!!Info about workspace feature', | 29 | defaultMessage: 'Info about workspace feature', |
30 | }, | 30 | }, |
31 | addNewWorkspaceLabel: { | 31 | addNewWorkspaceLabel: { |
32 | id: 'workspaceDrawer.addNewWorkspaceLabel', | 32 | id: 'workspaceDrawer.addNewWorkspaceLabel', |
33 | defaultMessage: '!!!add new workspace', | 33 | defaultMessage: 'add new workspace', |
34 | }, | 34 | }, |
35 | }); | 35 | }); |
36 | 36 | ||
37 | const styles = (theme) => ({ | 37 | const styles = theme => ({ |
38 | drawer: { | 38 | drawer: { |
39 | background: theme.workspaces.drawer.background, | 39 | background: theme.workspaces.drawer.background, |
40 | width: `${theme.workspaces.drawer.width}px`, | 40 | width: `${theme.workspaces.drawer.width}px`, |
@@ -85,34 +85,26 @@ const styles = (theme) => ({ | |||
85 | }, | 85 | }, |
86 | }); | 86 | }); |
87 | 87 | ||
88 | @injectSheet(styles) @observer | 88 | @injectSheet(styles) |
89 | @observer | ||
89 | class WorkspaceDrawer extends Component { | 90 | class WorkspaceDrawer extends Component { |
90 | static propTypes = { | 91 | static propTypes = { |
91 | classes: PropTypes.object.isRequired, | 92 | classes: PropTypes.object.isRequired, |
92 | getServicesForWorkspace: PropTypes.func.isRequired, | 93 | getServicesForWorkspace: PropTypes.func.isRequired, |
93 | }; | 94 | }; |
94 | 95 | ||
95 | static contextTypes = { | ||
96 | intl: intlShape, | ||
97 | }; | ||
98 | |||
99 | componentDidMount() { | 96 | componentDidMount() { |
100 | ReactTooltip.rebuild(); | 97 | ReactTooltip.rebuild(); |
101 | } | 98 | } |
102 | 99 | ||
103 | render() { | 100 | render() { |
104 | const { | 101 | const { classes, getServicesForWorkspace } = this.props; |
105 | classes, | 102 | const { intl } = this.props; |
106 | getServicesForWorkspace, | 103 | const { activeWorkspace, isSwitchingWorkspace, nextWorkspace, workspaces } = |
107 | } = this.props; | 104 | workspaceStore; |
108 | const { intl } = this.context; | 105 | const actualWorkspace = isSwitchingWorkspace |
109 | const { | 106 | ? nextWorkspace |
110 | activeWorkspace, | 107 | : activeWorkspace; |
111 | isSwitchingWorkspace, | ||
112 | nextWorkspace, | ||
113 | workspaces, | ||
114 | } = workspaceStore; | ||
115 | const actualWorkspace = isSwitchingWorkspace ? nextWorkspace : activeWorkspace; | ||
116 | return ( | 108 | return ( |
117 | <div className={`${classes.drawer} workspaces-drawer`}> | 109 | <div className={`${classes.drawer} workspaces-drawer`}> |
118 | <H1 className={classes.headline}> | 110 | <H1 className={classes.headline}> |
@@ -122,7 +114,9 @@ class WorkspaceDrawer extends Component { | |||
122 | onClick={() => { | 114 | onClick={() => { |
123 | workspaceActions.openWorkspaceSettings(); | 115 | workspaceActions.openWorkspaceSettings(); |
124 | }} | 116 | }} |
125 | data-tip={`${intl.formatMessage(messages.workspacesSettingsTooltip)}`} | 117 | data-tip={`${intl.formatMessage( |
118 | messages.workspacesSettingsTooltip, | ||
119 | )}`} | ||
126 | > | 120 | > |
127 | <Icon | 121 | <Icon |
128 | icon={mdiSettings} | 122 | icon={mdiSettings} |
@@ -152,7 +146,9 @@ class WorkspaceDrawer extends Component { | |||
152 | workspaceActions.activate({ workspace }); | 146 | workspaceActions.activate({ workspace }); |
153 | workspaceActions.toggleWorkspaceDrawer(); | 147 | workspaceActions.toggleWorkspaceDrawer(); |
154 | }} | 148 | }} |
155 | onContextMenuEditClick={() => workspaceActions.edit({ workspace })} | 149 | onContextMenuEditClick={() => |
150 | workspaceActions.edit({ workspace }) | ||
151 | } | ||
156 | services={getServicesForWorkspace(workspace)} | 152 | services={getServicesForWorkspace(workspace)} |
157 | shortcutIndex={index + 1} | 153 | shortcutIndex={index + 1} |
158 | /> | 154 | /> |
@@ -168,9 +164,7 @@ class WorkspaceDrawer extends Component { | |||
168 | size={1} | 164 | size={1} |
169 | className={classes.workspacesSettingsButtonIcon} | 165 | className={classes.workspacesSettingsButtonIcon} |
170 | /> | 166 | /> |
171 | <span> | 167 | <span>{intl.formatMessage(messages.addNewWorkspaceLabel)}</span> |
172 | {intl.formatMessage(messages.addNewWorkspaceLabel)} | ||
173 | </span> | ||
174 | </div> | 168 | </div> |
175 | </div> | 169 | </div> |
176 | <ReactTooltip place="right" type="dark" effect="solid" /> | 170 | <ReactTooltip place="right" type="dark" effect="solid" /> |
@@ -179,4 +173,4 @@ class WorkspaceDrawer extends Component { | |||
179 | } | 173 | } |
180 | } | 174 | } |
181 | 175 | ||
182 | export default WorkspaceDrawer; | 176 | export default injectIntl(WorkspaceDrawer); |
diff --git a/src/features/workspaces/components/WorkspaceDrawerItem.js b/src/features/workspaces/components/WorkspaceDrawerItem.js index 252158364..82e1b81a4 100644 --- a/src/features/workspaces/components/WorkspaceDrawerItem.js +++ b/src/features/workspaces/components/WorkspaceDrawerItem.js | |||
@@ -4,17 +4,17 @@ import PropTypes from 'prop-types'; | |||
4 | import { observer } from 'mobx-react'; | 4 | 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, injectIntl } from 'react-intl'; |
8 | import { altKey, cmdOrCtrlShortcutKey } from '../../../environment'; | 8 | import { altKey, cmdOrCtrlShortcutKey } from '../../../environment'; |
9 | 9 | ||
10 | const messages = defineMessages({ | 10 | const messages = defineMessages({ |
11 | noServicesAddedYet: { | 11 | noServicesAddedYet: { |
12 | id: 'workspaceDrawer.item.noServicesAddedYet', | 12 | id: 'workspaceDrawer.item.noServicesAddedYet', |
13 | defaultMessage: '!!!No services added yet', | 13 | defaultMessage: 'No services added yet', |
14 | }, | 14 | }, |
15 | contextMenuEdit: { | 15 | contextMenuEdit: { |
16 | id: 'workspaceDrawer.item.contextMenuEdit', | 16 | id: 'workspaceDrawer.item.contextMenuEdit', |
17 | defaultMessage: '!!!edit', | 17 | defaultMessage: 'edit', |
18 | }, | 18 | }, |
19 | }); | 19 | }); |
20 | 20 | ||
@@ -82,10 +82,6 @@ class WorkspaceDrawerItem extends Component { | |||
82 | onContextMenuEditClick: null, | 82 | onContextMenuEditClick: null, |
83 | }; | 83 | }; |
84 | 84 | ||
85 | static contextTypes = { | ||
86 | intl: intlShape, | ||
87 | }; | ||
88 | |||
89 | render() { | 85 | render() { |
90 | const { | 86 | const { |
91 | classes, | 87 | classes, |
@@ -96,7 +92,8 @@ class WorkspaceDrawerItem extends Component { | |||
96 | services, | 92 | services, |
97 | shortcutIndex, | 93 | shortcutIndex, |
98 | } = this.props; | 94 | } = this.props; |
99 | const { intl } = this.context; | 95 | |
96 | const { intl } = this.props; | ||
100 | 97 | ||
101 | const contextMenuTemplate = [ | 98 | const contextMenuTemplate = [ |
102 | { | 99 | { |
@@ -125,7 +122,11 @@ class WorkspaceDrawerItem extends Component { | |||
125 | onContextMenuEditClick && contextMenu.popup(getCurrentWindow()) | 122 | onContextMenuEditClick && contextMenu.popup(getCurrentWindow()) |
126 | } | 123 | } |
127 | data-tip={`${ | 124 | data-tip={`${ |
128 | shortcutIndex <= 9 ? `(${cmdOrCtrlShortcutKey(false)}+${altKey(false)}+${shortcutIndex})` : '' | 125 | shortcutIndex <= 9 |
126 | ? `(${cmdOrCtrlShortcutKey(false)}+${altKey( | ||
127 | false, | ||
128 | )}+${shortcutIndex})` | ||
129 | : '' | ||
129 | }`} | 130 | }`} |
130 | > | 131 | > |
131 | <span | 132 | <span |
@@ -151,4 +152,4 @@ class WorkspaceDrawerItem extends Component { | |||
151 | } | 152 | } |
152 | } | 153 | } |
153 | 154 | ||
154 | export default WorkspaceDrawerItem; | 155 | export default injectIntl(WorkspaceDrawerItem); |
diff --git a/src/features/workspaces/components/WorkspaceItem.js b/src/features/workspaces/components/WorkspaceItem.js index 85fc02d51..ec7b19add 100644 --- a/src/features/workspaces/components/WorkspaceItem.js +++ b/src/features/workspaces/components/WorkspaceItem.js | |||
@@ -1,12 +1,11 @@ | |||
1 | import React, { Component } from 'react'; | 1 | import React, { Component } from 'react'; |
2 | import PropTypes from 'prop-types'; | 2 | import PropTypes from 'prop-types'; |
3 | import { intlShape } from 'react-intl'; | ||
4 | import { observer } from 'mobx-react'; | 3 | import { observer } from 'mobx-react'; |
5 | import injectSheet from 'react-jss'; | 4 | import injectSheet from 'react-jss'; |
6 | 5 | ||
7 | import Workspace from '../models/Workspace'; | 6 | import Workspace from '../models/Workspace'; |
8 | 7 | ||
9 | const styles = (theme) => ({ | 8 | const styles = theme => ({ |
10 | row: { | 9 | row: { |
11 | height: theme.workspaces.settings.listItems.height, | 10 | height: theme.workspaces.settings.listItems.height, |
12 | borderBottom: `1px solid ${theme.workspaces.settings.listItems.borderColor}`, | 11 | borderBottom: `1px solid ${theme.workspaces.settings.listItems.borderColor}`, |
@@ -17,7 +16,8 @@ const styles = (theme) => ({ | |||
17 | columnName: {}, | 16 | columnName: {}, |
18 | }); | 17 | }); |
19 | 18 | ||
20 | @injectSheet(styles) @observer | 19 | @injectSheet(styles) |
20 | @observer | ||
21 | class WorkspaceItem extends Component { | 21 | class WorkspaceItem extends Component { |
22 | static propTypes = { | 22 | static propTypes = { |
23 | classes: PropTypes.object.isRequired, | 23 | classes: PropTypes.object.isRequired, |
@@ -25,18 +25,12 @@ class WorkspaceItem extends Component { | |||
25 | onItemClick: PropTypes.func.isRequired, | 25 | onItemClick: PropTypes.func.isRequired, |
26 | }; | 26 | }; |
27 | 27 | ||
28 | static contextTypes = { | ||
29 | intl: intlShape, | ||
30 | }; | ||
31 | |||
32 | render() { | 28 | render() { |
33 | const { classes, workspace, onItemClick } = this.props; | 29 | const { classes, workspace, onItemClick } = this.props; |
34 | 30 | ||
35 | return ( | 31 | return ( |
36 | <tr className={classes.row}> | 32 | <tr className={classes.row}> |
37 | <td onClick={() => onItemClick(workspace)}> | 33 | <td onClick={() => onItemClick(workspace)}>{workspace.name}</td> |
38 | {workspace.name} | ||
39 | </td> | ||
40 | </tr> | 34 | </tr> |
41 | ); | 35 | ); |
42 | } | 36 | } |
diff --git a/src/features/workspaces/components/WorkspaceSwitchingIndicator.js b/src/features/workspaces/components/WorkspaceSwitchingIndicator.js index c8ec0bc4c..33a82cf4b 100644 --- a/src/features/workspaces/components/WorkspaceSwitchingIndicator.js +++ b/src/features/workspaces/components/WorkspaceSwitchingIndicator.js | |||
@@ -4,14 +4,14 @@ import { observer } from 'mobx-react'; | |||
4 | import injectSheet from 'react-jss'; | 4 | import injectSheet from 'react-jss'; |
5 | import classnames from 'classnames'; | 5 | import classnames from 'classnames'; |
6 | import { Loader } from '@meetfranz/ui'; | 6 | import { Loader } from '@meetfranz/ui'; |
7 | import { defineMessages, intlShape } from 'react-intl'; | 7 | import { defineMessages, injectIntl } from 'react-intl'; |
8 | 8 | ||
9 | import { workspaceStore } from '../index'; | 9 | import { workspaceStore } from '../index'; |
10 | 10 | ||
11 | const messages = defineMessages({ | 11 | const messages = defineMessages({ |
12 | switchingTo: { | 12 | switchingTo: { |
13 | id: 'workspaces.switchingIndicator.switchingTo', | 13 | id: 'workspaces.switchingIndicator.switchingTo', |
14 | defaultMessage: '!!!Switching to', | 14 | defaultMessage: 'Switching to', |
15 | }, | 15 | }, |
16 | }); | 16 | }); |
17 | 17 | ||
@@ -61,13 +61,9 @@ class WorkspaceSwitchingIndicator extends Component { | |||
61 | theme: PropTypes.object.isRequired, | 61 | theme: PropTypes.object.isRequired, |
62 | }; | 62 | }; |
63 | 63 | ||
64 | static contextTypes = { | ||
65 | intl: intlShape, | ||
66 | }; | ||
67 | |||
68 | render() { | 64 | render() { |
69 | const { classes, theme } = this.props; | 65 | const { classes, theme } = this.props; |
70 | const { intl } = this.context; | 66 | const { intl } = this.props; |
71 | const { isSwitchingWorkspace, nextWorkspace } = workspaceStore; | 67 | const { isSwitchingWorkspace, nextWorkspace } = workspaceStore; |
72 | if (!isSwitchingWorkspace) return null; | 68 | if (!isSwitchingWorkspace) return null; |
73 | const nextWorkspaceName = nextWorkspace | 69 | const nextWorkspaceName = nextWorkspace |
@@ -89,4 +85,4 @@ class WorkspaceSwitchingIndicator extends Component { | |||
89 | } | 85 | } |
90 | } | 86 | } |
91 | 87 | ||
92 | export default WorkspaceSwitchingIndicator; | 88 | export default injectIntl(WorkspaceSwitchingIndicator); |
diff --git a/src/features/workspaces/components/WorkspacesDashboard.js b/src/features/workspaces/components/WorkspacesDashboard.js index 5f34204f1..fd279f896 100644 --- a/src/features/workspaces/components/WorkspacesDashboard.js +++ b/src/features/workspaces/components/WorkspacesDashboard.js | |||
@@ -1,7 +1,7 @@ | |||
1 | import React, { Component } from 'react'; | 1 | import React, { Component } from 'react'; |
2 | import PropTypes from 'prop-types'; | 2 | import PropTypes from 'prop-types'; |
3 | import { observer, PropTypes as MobxPropTypes, inject } from 'mobx-react'; | 3 | import { observer, PropTypes as MobxPropTypes, inject } from 'mobx-react'; |
4 | import { defineMessages, intlShape } from 'react-intl'; | 4 | import { defineMessages, injectIntl } from 'react-intl'; |
5 | import injectSheet from 'react-jss'; | 5 | import injectSheet from 'react-jss'; |
6 | import { Infobox } from '@meetfranz/ui'; | 6 | import { Infobox } from '@meetfranz/ui'; |
7 | 7 | ||
@@ -16,35 +16,35 @@ import UIStore from '../../../stores/UIStore'; | |||
16 | const messages = defineMessages({ | 16 | const messages = defineMessages({ |
17 | headline: { | 17 | headline: { |
18 | id: 'settings.workspaces.headline', | 18 | id: 'settings.workspaces.headline', |
19 | defaultMessage: '!!!Your workspaces', | 19 | defaultMessage: 'Your workspaces', |
20 | }, | 20 | }, |
21 | noServicesAdded: { | 21 | noServicesAdded: { |
22 | id: 'settings.workspaces.noWorkspacesAdded', | 22 | id: 'settings.workspaces.noWorkspacesAdded', |
23 | defaultMessage: "!!!You haven't created any workspaces yet.", | 23 | defaultMessage: "You haven't created any workspaces yet.", |
24 | }, | 24 | }, |
25 | workspacesRequestFailed: { | 25 | workspacesRequestFailed: { |
26 | id: 'settings.workspaces.workspacesRequestFailed', | 26 | id: 'settings.workspaces.workspacesRequestFailed', |
27 | defaultMessage: '!!!Could not load your workspaces', | 27 | defaultMessage: 'Could not load your workspaces', |
28 | }, | 28 | }, |
29 | tryReloadWorkspaces: { | 29 | tryReloadWorkspaces: { |
30 | id: 'settings.workspaces.tryReloadWorkspaces', | 30 | id: 'settings.workspaces.tryReloadWorkspaces', |
31 | defaultMessage: '!!!Try again', | 31 | defaultMessage: 'Try again', |
32 | }, | 32 | }, |
33 | updatedInfo: { | 33 | updatedInfo: { |
34 | id: 'settings.workspaces.updatedInfo', | 34 | id: 'settings.workspaces.updatedInfo', |
35 | defaultMessage: '!!!Your changes have been saved', | 35 | defaultMessage: 'Your changes have been saved', |
36 | }, | 36 | }, |
37 | deletedInfo: { | 37 | deletedInfo: { |
38 | id: 'settings.workspaces.deletedInfo', | 38 | id: 'settings.workspaces.deletedInfo', |
39 | defaultMessage: '!!!Workspace has been deleted', | 39 | defaultMessage: 'Workspace has been deleted', |
40 | }, | 40 | }, |
41 | workspaceFeatureInfo: { | 41 | workspaceFeatureInfo: { |
42 | id: 'settings.workspaces.workspaceFeatureInfo', | 42 | id: 'settings.workspaces.workspaceFeatureInfo', |
43 | defaultMessage: '!!!Info about workspace feature', | 43 | defaultMessage: 'Info about workspace feature', |
44 | }, | 44 | }, |
45 | workspaceFeatureHeadline: { | 45 | workspaceFeatureHeadline: { |
46 | id: 'settings.workspaces.workspaceFeatureHeadline', | 46 | id: 'settings.workspaces.workspaceFeatureHeadline', |
47 | defaultMessage: '!!!Less is More: Introducing Ferdi Workspaces', | 47 | defaultMessage: 'Less is More: Introducing Ferdi Workspaces', |
48 | }, | 48 | }, |
49 | }); | 49 | }); |
50 | 50 | ||
@@ -83,10 +83,6 @@ class WorkspacesDashboard extends Component { | |||
83 | workspaces: MobxPropTypes.arrayOrObservableArray.isRequired, | 83 | workspaces: MobxPropTypes.arrayOrObservableArray.isRequired, |
84 | }; | 84 | }; |
85 | 85 | ||
86 | static contextTypes = { | ||
87 | intl: intlShape, | ||
88 | }; | ||
89 | |||
90 | render() { | 86 | render() { |
91 | const { | 87 | const { |
92 | classes, | 88 | classes, |
@@ -99,7 +95,7 @@ class WorkspacesDashboard extends Component { | |||
99 | workspaces, | 95 | workspaces, |
100 | } = this.props; | 96 | } = this.props; |
101 | 97 | ||
102 | const { intl } = this.context; | 98 | const { intl } = this.props; |
103 | 99 | ||
104 | return ( | 100 | return ( |
105 | <div className="settings__main"> | 101 | <div className="settings__main"> |
@@ -193,7 +189,7 @@ class WorkspacesDashboard extends Component { | |||
193 | } | 189 | } |
194 | } | 190 | } |
195 | 191 | ||
196 | export default WorkspacesDashboard; | 192 | export default injectIntl(WorkspacesDashboard); |
197 | 193 | ||
198 | WorkspacesDashboard.wrappedComponent.propTypes = { | 194 | WorkspacesDashboard.wrappedComponent.propTypes = { |
199 | stores: PropTypes.shape({ | 195 | stores: PropTypes.shape({ |