aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/workspaces/components/WorkspaceDrawer.js
diff options
context:
space:
mode:
authorLibravatar Markus Hatvan <markus_hatvan@aon.at>2021-09-13 14:45:46 +0200
committerLibravatar GitHub <noreply@github.com>2021-09-13 14:45:46 +0200
commit537697a6e9757f118d09d9e76362ba1ff617e2c6 (patch)
treebc55447115e385137684e84697a8c15d2199b8d5 /src/features/workspaces/components/WorkspaceDrawer.js
parentBumped up version to: 5.6.3-nightly.0 [skip ci] (diff)
downloadferdium-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/WorkspaceDrawer.js')
-rw-r--r--src/features/workspaces/components/WorkspaceDrawer.js54
1 files changed, 24 insertions, 30 deletions
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';
2import PropTypes from 'prop-types'; 2import PropTypes from 'prop-types';
3import { observer } from 'mobx-react'; 3import { observer } from 'mobx-react';
4import injectSheet from 'react-jss'; 4import injectSheet from 'react-jss';
5import { defineMessages, intlShape } from 'react-intl'; 5import { defineMessages, injectIntl } from 'react-intl';
6import { H1, Icon } from '@meetfranz/ui'; 6import { H1, Icon } from '@meetfranz/ui';
7import ReactTooltip from 'react-tooltip'; 7import ReactTooltip from 'react-tooltip';
8 8
@@ -14,27 +14,27 @@ import { workspaceStore } from '../index';
14const messages = defineMessages({ 14const 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
37const styles = (theme) => ({ 37const 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
89class WorkspaceDrawer extends Component { 90class 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
182export default WorkspaceDrawer; 176export default injectIntl(WorkspaceDrawer);