diff options
author | Markus Hatvan <markus_hatvan@aon.at> | 2021-09-13 14:45:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-13 14:45:46 +0200 |
commit | 537697a6e9757f118d09d9e76362ba1ff617e2c6 (patch) | |
tree | bc55447115e385137684e84697a8c15d2199b8d5 /src/components/services/content/Services.js | |
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/components/services/content/Services.js')
-rw-r--r-- | src/components/services/content/Services.js | 103 |
1 files changed, 55 insertions, 48 deletions
diff --git a/src/components/services/content/Services.js b/src/components/services/content/Services.js index bb93ff7d4..fb43fb816 100644 --- a/src/components/services/content/Services.js +++ b/src/components/services/content/Services.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, PropTypes as MobxPropTypes, inject } from 'mobx-react'; | 3 | import { observer, PropTypes as MobxPropTypes, inject } from 'mobx-react'; |
4 | import { Link } from 'react-router'; | 4 | import { Link } from 'react-router'; |
5 | import { defineMessages, intlShape } from 'react-intl'; | 5 | import { defineMessages, injectIntl } from 'react-intl'; |
6 | import Confetti from 'react-confetti'; | 6 | import Confetti from 'react-confetti'; |
7 | import ms from 'ms'; | 7 | import ms from 'ms'; |
8 | import injectSheet from 'react-jss'; | 8 | import injectSheet from 'react-jss'; |
@@ -14,23 +14,24 @@ import serverlessLogin from '../../../helpers/serverless-helpers'; | |||
14 | const messages = defineMessages({ | 14 | const messages = defineMessages({ |
15 | welcome: { | 15 | welcome: { |
16 | id: 'services.welcome', | 16 | id: 'services.welcome', |
17 | defaultMessage: '!!!Welcome to Ferdi', | 17 | defaultMessage: 'Welcome to Ferdi', |
18 | }, | 18 | }, |
19 | getStarted: { | 19 | getStarted: { |
20 | id: 'services.getStarted', | 20 | id: 'services.getStarted', |
21 | defaultMessage: '!!!Get started', | 21 | defaultMessage: 'Get started', |
22 | }, | 22 | }, |
23 | login: { | 23 | login: { |
24 | id: 'services.login', | 24 | id: 'services.login', |
25 | defaultMessage: '!!!Please login to use Ferdi.', | 25 | defaultMessage: 'Please login to use Ferdi.', |
26 | }, | 26 | }, |
27 | serverless: { | 27 | serverless: { |
28 | id: 'services.serverless', | 28 | id: 'services.serverless', |
29 | defaultMessage: '!!!Use Ferdi without an Account', | 29 | defaultMessage: 'Use Ferdi without an Account', |
30 | }, | 30 | }, |
31 | serverInfo: { | 31 | serverInfo: { |
32 | id: 'services.serverInfo', | 32 | id: 'services.serverInfo', |
33 | defaultMessage: '!!!Optionally, you can change your Ferdi server by clicking the cog in the bottom left corner. If you are switching over (from one of the hosted servers) to using Ferdi without an account, please be informed that you can export your data from that server and subsequently import it using the Help menu to resurrect all your workspaces and configured services!', | 33 | defaultMessage: |
34 | 'Optionally, you can change your Ferdi server by clicking the cog in the bottom left corner. If you are switching over (from one of the hosted servers) to using Ferdi without an account, please be informed that you can export your data from that server and subsequently import it using the Help menu to resurrect all your workspaces and configured services!', | ||
34 | }, | 35 | }, |
35 | }); | 36 | }); |
36 | 37 | ||
@@ -43,7 +44,10 @@ const styles = { | |||
43 | }, | 44 | }, |
44 | }; | 45 | }; |
45 | 46 | ||
46 | export default @injectSheet(styles) @inject('actions') @observer class Services extends Component { | 47 | @injectSheet(styles) |
48 | @inject('actions') | ||
49 | @observer | ||
50 | class Services extends Component { | ||
47 | static propTypes = { | 51 | static propTypes = { |
48 | services: MobxPropTypes.arrayOrObservableArray, | 52 | services: MobxPropTypes.arrayOrObservableArray, |
49 | setWebviewReference: PropTypes.func.isRequired, | 53 | setWebviewReference: PropTypes.func.isRequired, |
@@ -63,10 +67,6 @@ export default @injectSheet(styles) @inject('actions') @observer class Services | |||
63 | services: [], | 67 | services: [], |
64 | }; | 68 | }; |
65 | 69 | ||
66 | static contextTypes = { | ||
67 | intl: intlShape, | ||
68 | }; | ||
69 | |||
70 | state = { | 70 | state = { |
71 | showConfetti: true, | 71 | showConfetti: true, |
72 | }; | 72 | }; |
@@ -112,11 +112,9 @@ export default @injectSheet(styles) @inject('actions') @observer class Services | |||
112 | isSpellcheckerEnabled, | 112 | isSpellcheckerEnabled, |
113 | } = this.props; | 113 | } = this.props; |
114 | 114 | ||
115 | const { | 115 | const { showConfetti } = this.state; |
116 | showConfetti, | ||
117 | } = this.state; | ||
118 | 116 | ||
119 | const { intl } = this.context; | 117 | const { intl } = this.props; |
120 | const isLoggedIn = Boolean(localStorage.getItem('authToken')); | 118 | const isLoggedIn = Boolean(localStorage.getItem('authToken')); |
121 | 119 | ||
122 | return ( | 120 | return ( |
@@ -131,25 +129,28 @@ export default @injectSheet(styles) @inject('actions') @observer class Services | |||
131 | </div> | 129 | </div> |
132 | )} | 130 | )} |
133 | {services.length === 0 && ( | 131 | {services.length === 0 && ( |
134 | <Appear | 132 | <Appear timeout={1500} transitionName="slideUp"> |
135 | timeout={1500} | ||
136 | transitionName="slideUp" | ||
137 | > | ||
138 | <div className="services__no-service"> | 133 | <div className="services__no-service"> |
139 | <img src="./assets/images/logo.svg" alt="Logo" style={{ maxHeight: '50vh' }} /> | 134 | <img |
135 | src="./assets/images/logo.svg" | ||
136 | alt="Logo" | ||
137 | style={{ maxHeight: '50vh' }} | ||
138 | /> | ||
140 | <h1>{intl.formatMessage(messages.welcome)}</h1> | 139 | <h1>{intl.formatMessage(messages.welcome)}</h1> |
141 | { !isLoggedIn && ( | 140 | {!isLoggedIn && ( |
142 | <> | 141 | <> |
143 | <p>{intl.formatMessage(messages.login)}</p> | 142 | <p>{intl.formatMessage(messages.login)}</p> |
144 | <p>{intl.formatMessage(messages.serverInfo)}</p> | 143 | <p>{intl.formatMessage(messages.serverInfo)}</p> |
145 | </> | 144 | </> |
146 | ) } | 145 | )} |
147 | <Appear | 146 | <Appear timeout={300} transitionName="slideUp"> |
148 | timeout={300} | 147 | <Link |
149 | transitionName="slideUp" | 148 | to={isLoggedIn ? '/settings/recipes' : '/auth/welcome'} |
150 | > | 149 | className="button" |
151 | <Link to={isLoggedIn ? '/settings/recipes' : '/auth/welcome'} className="button"> | 150 | > |
152 | { isLoggedIn ? intl.formatMessage(messages.getStarted) : 'Login' } | 151 | {isLoggedIn |
152 | ? intl.formatMessage(messages.getStarted) | ||
153 | : 'Login'} | ||
153 | </Link> | 154 | </Link> |
154 | {!isLoggedIn && ( | 155 | {!isLoggedIn && ( |
155 | <button | 156 | <button |
@@ -167,27 +168,33 @@ export default @injectSheet(styles) @inject('actions') @observer class Services | |||
167 | </div> | 168 | </div> |
168 | </Appear> | 169 | </Appear> |
169 | )} | 170 | )} |
170 | {services.filter((service) => !service.isTodosService).map((service) => ( | 171 | {services |
171 | <ServiceView | 172 | .filter(service => !service.isTodosService) |
172 | key={service.id} | 173 | .map(service => ( |
173 | service={service} | 174 | <ServiceView |
174 | handleIPCMessage={handleIPCMessage} | 175 | key={service.id} |
175 | setWebviewReference={setWebviewReference} | 176 | service={service} |
176 | detachService={detachService} | 177 | handleIPCMessage={handleIPCMessage} |
177 | openWindow={openWindow} | 178 | setWebviewReference={setWebviewReference} |
178 | reload={() => reload({ serviceId: service.id })} | 179 | detachService={detachService} |
179 | edit={() => openSettings({ path: `services/edit/${service.id}` })} | 180 | openWindow={openWindow} |
180 | enable={() => update({ | 181 | reload={() => reload({ serviceId: service.id })} |
181 | serviceId: service.id, | 182 | edit={() => openSettings({ path: `services/edit/${service.id}` })} |
182 | serviceData: { | 183 | enable={() => |
183 | isEnabled: true, | 184 | update({ |
184 | }, | 185 | serviceId: service.id, |
185 | redirect: false, | 186 | serviceData: { |
186 | })} | 187 | isEnabled: true, |
187 | isSpellcheckerEnabled={isSpellcheckerEnabled} | 188 | }, |
188 | /> | 189 | redirect: false, |
189 | ))} | 190 | }) |
191 | } | ||
192 | isSpellcheckerEnabled={isSpellcheckerEnabled} | ||
193 | /> | ||
194 | ))} | ||
190 | </div> | 195 | </div> |
191 | ); | 196 | ); |
192 | } | 197 | } |
193 | } | 198 | } |
199 | |||
200 | export default injectIntl(Services); | ||