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/features/publishDebugInfo/Component.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/features/publishDebugInfo/Component.js')
-rw-r--r-- | src/features/publishDebugInfo/Component.js | 94 |
1 files changed, 54 insertions, 40 deletions
diff --git a/src/features/publishDebugInfo/Component.js b/src/features/publishDebugInfo/Component.js index 5387bd358..5b5036752 100644 --- a/src/features/publishDebugInfo/Component.js +++ b/src/features/publishDebugInfo/Component.js | |||
@@ -2,7 +2,7 @@ import { H1 } from '@meetfranz/ui'; | |||
2 | import { inject, observer } from 'mobx-react'; | 2 | import { inject, observer } from 'mobx-react'; |
3 | import PropTypes from 'prop-types'; | 3 | import PropTypes from 'prop-types'; |
4 | import React, { Component } from 'react'; | 4 | import React, { Component } from 'react'; |
5 | import { defineMessages, intlShape } from 'react-intl'; | 5 | import { defineMessages, injectIntl } from 'react-intl'; |
6 | import injectSheet from 'react-jss'; | 6 | import injectSheet from 'react-jss'; |
7 | import { state as ModalState } from './store'; | 7 | import { state as ModalState } from './store'; |
8 | import { sendAuthRequest } from '../../api/utils/auth'; | 8 | import { sendAuthRequest } from '../../api/utils/auth'; |
@@ -18,35 +18,37 @@ const debug = require('debug')('Ferdi:feature:publishDebugInfo'); | |||
18 | const messages = defineMessages({ | 18 | const messages = defineMessages({ |
19 | title: { | 19 | title: { |
20 | id: 'feature.publishDebugInfo.title', | 20 | id: 'feature.publishDebugInfo.title', |
21 | defaultMessage: '!!!Publish debug information', | 21 | defaultMessage: 'Publish debug information', |
22 | }, | 22 | }, |
23 | info: { | 23 | info: { |
24 | id: 'feature.publishDebugInfo.info', | 24 | id: 'feature.publishDebugInfo.info', |
25 | defaultMessage: '!!!Publishing your debug information helps us find issues and errors in Ferdi. By publishing your debug information you accept Ferdi Debugger\'s privacy policy and terms of service', | 25 | defaultMessage: |
26 | "Publishing your debug information helps us find issues and errors in Ferdi. By publishing your debug information you accept Ferdi Debugger's privacy policy and terms of service", | ||
26 | }, | 27 | }, |
27 | error: { | 28 | error: { |
28 | id: 'feature.publishDebugInfo.error', | 29 | id: 'feature.publishDebugInfo.error', |
29 | defaultMessage: '!!!There was an error while trying to publish the debug information. Please try again later or view the console for more information.', | 30 | defaultMessage: |
31 | 'There was an error while trying to publish the debug information. Please try again later or view the console for more information.', | ||
30 | }, | 32 | }, |
31 | privacy: { | 33 | privacy: { |
32 | id: 'feature.publishDebugInfo.privacy', | 34 | id: 'feature.publishDebugInfo.privacy', |
33 | defaultMessage: '!!!Privacy policy', | 35 | defaultMessage: 'Privacy policy', |
34 | }, | 36 | }, |
35 | terms: { | 37 | terms: { |
36 | id: 'feature.publishDebugInfo.terms', | 38 | id: 'feature.publishDebugInfo.terms', |
37 | defaultMessage: '!!!Terms of service', | 39 | defaultMessage: 'Terms of service', |
38 | }, | 40 | }, |
39 | publish: { | 41 | publish: { |
40 | id: 'feature.publishDebugInfo.publish', | 42 | id: 'feature.publishDebugInfo.publish', |
41 | defaultMessage: '!!!Accept and publish', | 43 | defaultMessage: 'Accept and publish', |
42 | }, | 44 | }, |
43 | published: { | 45 | published: { |
44 | id: 'feature.publishDebugInfo.published', | 46 | id: 'feature.publishDebugInfo.published', |
45 | defaultMessage: '!!!Your debug log was published and is now availible at', | 47 | defaultMessage: 'Your debug log was published and is now availible at', |
46 | }, | 48 | }, |
47 | }); | 49 | }); |
48 | 50 | ||
49 | const styles = (theme) => ({ | 51 | const styles = theme => ({ |
50 | container: { | 52 | container: { |
51 | minWidth: '70vw', | 53 | minWidth: '70vw', |
52 | }, | 54 | }, |
@@ -69,7 +71,8 @@ const styles = (theme) => ({ | |||
69 | width: '100%', | 71 | width: '100%', |
70 | 72 | ||
71 | '& div': { | 73 | '& div': { |
72 | fontFamily: 'SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace', | 74 | fontFamily: |
75 | 'SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace', | ||
73 | }, | 76 | }, |
74 | 77 | ||
75 | '& input': { | 78 | '& input': { |
@@ -81,20 +84,19 @@ const styles = (theme) => ({ | |||
81 | }, | 84 | }, |
82 | }); | 85 | }); |
83 | 86 | ||
84 | export default @injectSheet(styles) @inject('stores', 'actions') @observer class PublishDebugLogModal extends Component { | 87 | @injectSheet(styles) |
88 | @inject('stores', 'actions') | ||
89 | @observer | ||
90 | class PublishDebugLogModal extends Component { | ||
85 | static propTypes = { | 91 | static propTypes = { |
86 | classes: PropTypes.object.isRequired, | 92 | classes: PropTypes.object.isRequired, |
87 | }; | 93 | }; |
88 | 94 | ||
89 | static contextTypes = { | ||
90 | intl: intlShape, | ||
91 | }; | ||
92 | |||
93 | state = { | 95 | state = { |
94 | log: null, | 96 | log: null, |
95 | error: false, | 97 | error: false, |
96 | isSendingLog: false, | 98 | isSendingLog: false, |
97 | } | 99 | }; |
98 | 100 | ||
99 | // Close this modal | 101 | // Close this modal |
100 | close() { | 102 | close() { |
@@ -109,12 +111,16 @@ export default @injectSheet(styles) @inject('stores', 'actions') @observer class | |||
109 | 111 | ||
110 | const debugInfo = JSON.stringify(this.props.stores.app.debugInfo); | 112 | const debugInfo = JSON.stringify(this.props.stores.app.debugInfo); |
111 | 113 | ||
112 | const request = await sendAuthRequest(`${DEBUG_API}/create`, { | 114 | const request = await sendAuthRequest( |
113 | method: 'POST', | 115 | `${DEBUG_API}/create`, |
114 | body: JSON.stringify({ | 116 | { |
115 | log: debugInfo, | 117 | method: 'POST', |
116 | }), | 118 | body: JSON.stringify({ |
117 | }, false); | 119 | log: debugInfo, |
120 | }), | ||
121 | }, | ||
122 | false, | ||
123 | ); | ||
118 | 124 | ||
119 | debug(`debugInfo: publishing status: ${request.status}`); | 125 | debug(`debugInfo: publishing status: ${request.status}`); |
120 | if (request.status === 200) { | 126 | if (request.status === 200) { |
@@ -140,17 +146,11 @@ export default @injectSheet(styles) @inject('stores', 'actions') @observer class | |||
140 | render() { | 146 | render() { |
141 | const { isModalVisible } = ModalState; | 147 | const { isModalVisible } = ModalState; |
142 | 148 | ||
143 | const { | 149 | const { classes } = this.props; |
144 | classes, | ||
145 | } = this.props; | ||
146 | 150 | ||
147 | const { | 151 | const { log, error, isSendingLog } = this.state; |
148 | log, | ||
149 | error, | ||
150 | isSendingLog, | ||
151 | } = this.state; | ||
152 | 152 | ||
153 | const { intl } = this.context; | 153 | const { intl } = this.props; |
154 | 154 | ||
155 | return ( | 155 | return ( |
156 | <Modal | 156 | <Modal |
@@ -159,12 +159,12 @@ export default @injectSheet(styles) @inject('stores', 'actions') @observer class | |||
159 | close={() => this.close()} | 159 | close={() => this.close()} |
160 | > | 160 | > |
161 | <div className={classes.container}> | 161 | <div className={classes.container}> |
162 | <H1> | 162 | <H1>{intl.formatMessage(messages.title)}</H1> |
163 | {intl.formatMessage(messages.title)} | 163 | {log && ( |
164 | </H1> | ||
165 | { log && ( | ||
166 | <> | 164 | <> |
167 | <p className={classes.info}>{intl.formatMessage(messages.published)}</p> | 165 | <p className={classes.info}> |
166 | {intl.formatMessage(messages.published)} | ||
167 | </p> | ||
168 | <Input | 168 | <Input |
169 | className={classes.url} | 169 | className={classes.url} |
170 | showLabel={false} | 170 | showLabel={false} |
@@ -184,12 +184,24 @@ export default @injectSheet(styles) @inject('stores', 'actions') @observer class | |||
184 | 184 | ||
185 | {!log && !error && ( | 185 | {!log && !error && ( |
186 | <> | 186 | <> |
187 | <p className={classes.info}>{intl.formatMessage(messages.info)}</p> | 187 | <p className={classes.info}> |
188 | 188 | {intl.formatMessage(messages.info)} | |
189 | <a href={`${DEBUG_API}/privacy.html`} target="_blank" className={classes.link} rel="noreferrer"> | 189 | </p> |
190 | |||
191 | <a | ||
192 | href={`${DEBUG_API}/privacy.html`} | ||
193 | target="_blank" | ||
194 | className={classes.link} | ||
195 | rel="noreferrer" | ||
196 | > | ||
190 | {intl.formatMessage(messages.privacy)} | 197 | {intl.formatMessage(messages.privacy)} |
191 | </a> | 198 | </a> |
192 | <a href={`${DEBUG_API}/terms.html`} target="_blank" className={classes.link} rel="noreferrer"> | 199 | <a |
200 | href={`${DEBUG_API}/terms.html`} | ||
201 | target="_blank" | ||
202 | className={classes.link} | ||
203 | rel="noreferrer" | ||
204 | > | ||
193 | {intl.formatMessage(messages.terms)} | 205 | {intl.formatMessage(messages.terms)} |
194 | </a> | 206 | </a> |
195 | 207 | ||
@@ -216,3 +228,5 @@ PublishDebugLogModal.wrappedComponent.propTypes = { | |||
216 | service: PropTypes.instanceOf(ServicesStore).isRequired, | 228 | service: PropTypes.instanceOf(ServicesStore).isRequired, |
217 | }).isRequired, | 229 | }).isRequired, |
218 | }; | 230 | }; |
231 | |||
232 | export default injectIntl(PublishDebugLogModal); | ||