From 537697a6e9757f118d09d9e76362ba1ff617e2c6 Mon Sep 17 00:00:00 2001 From: Markus Hatvan Date: Mon, 13 Sep 2021 14:45:46 +0200 Subject: chore: upgrade intl dependencies (#1920) --- src/features/publishDebugInfo/Component.js | 94 +++++++++++++++++------------- 1 file changed, 54 insertions(+), 40 deletions(-) (limited to 'src/features/publishDebugInfo') 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'; import { inject, observer } from 'mobx-react'; import PropTypes from 'prop-types'; import React, { Component } from 'react'; -import { defineMessages, intlShape } from 'react-intl'; +import { defineMessages, injectIntl } from 'react-intl'; import injectSheet from 'react-jss'; import { state as ModalState } from './store'; import { sendAuthRequest } from '../../api/utils/auth'; @@ -18,35 +18,37 @@ const debug = require('debug')('Ferdi:feature:publishDebugInfo'); const messages = defineMessages({ title: { id: 'feature.publishDebugInfo.title', - defaultMessage: '!!!Publish debug information', + defaultMessage: 'Publish debug information', }, info: { id: 'feature.publishDebugInfo.info', - 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', + 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", }, error: { id: 'feature.publishDebugInfo.error', - defaultMessage: '!!!There was an error while trying to publish the debug information. Please try again later or view the console for more information.', + defaultMessage: + 'There was an error while trying to publish the debug information. Please try again later or view the console for more information.', }, privacy: { id: 'feature.publishDebugInfo.privacy', - defaultMessage: '!!!Privacy policy', + defaultMessage: 'Privacy policy', }, terms: { id: 'feature.publishDebugInfo.terms', - defaultMessage: '!!!Terms of service', + defaultMessage: 'Terms of service', }, publish: { id: 'feature.publishDebugInfo.publish', - defaultMessage: '!!!Accept and publish', + defaultMessage: 'Accept and publish', }, published: { id: 'feature.publishDebugInfo.published', - defaultMessage: '!!!Your debug log was published and is now availible at', + defaultMessage: 'Your debug log was published and is now availible at', }, }); -const styles = (theme) => ({ +const styles = theme => ({ container: { minWidth: '70vw', }, @@ -69,7 +71,8 @@ const styles = (theme) => ({ width: '100%', '& div': { - fontFamily: 'SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace', + fontFamily: + 'SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace', }, '& input': { @@ -81,20 +84,19 @@ const styles = (theme) => ({ }, }); -export default @injectSheet(styles) @inject('stores', 'actions') @observer class PublishDebugLogModal extends Component { +@injectSheet(styles) +@inject('stores', 'actions') +@observer +class PublishDebugLogModal extends Component { static propTypes = { classes: PropTypes.object.isRequired, }; - static contextTypes = { - intl: intlShape, - }; - state = { log: null, error: false, isSendingLog: false, - } + }; // Close this modal close() { @@ -109,12 +111,16 @@ export default @injectSheet(styles) @inject('stores', 'actions') @observer class const debugInfo = JSON.stringify(this.props.stores.app.debugInfo); - const request = await sendAuthRequest(`${DEBUG_API}/create`, { - method: 'POST', - body: JSON.stringify({ - log: debugInfo, - }), - }, false); + const request = await sendAuthRequest( + `${DEBUG_API}/create`, + { + method: 'POST', + body: JSON.stringify({ + log: debugInfo, + }), + }, + false, + ); debug(`debugInfo: publishing status: ${request.status}`); if (request.status === 200) { @@ -140,17 +146,11 @@ export default @injectSheet(styles) @inject('stores', 'actions') @observer class render() { const { isModalVisible } = ModalState; - const { - classes, - } = this.props; + const { classes } = this.props; - const { - log, - error, - isSendingLog, - } = this.state; + const { log, error, isSendingLog } = this.state; - const { intl } = this.context; + const { intl } = this.props; return ( this.close()} >
-

- {intl.formatMessage(messages.title)} -

- { log && ( +

{intl.formatMessage(messages.title)}

+ {log && ( <> -

{intl.formatMessage(messages.published)}

+

+ {intl.formatMessage(messages.published)} +

-

{intl.formatMessage(messages.info)}

- - +

+ {intl.formatMessage(messages.info)} +

+ +
{intl.formatMessage(messages.privacy)} - + {intl.formatMessage(messages.terms)} @@ -216,3 +228,5 @@ PublishDebugLogModal.wrappedComponent.propTypes = { service: PropTypes.instanceOf(ServicesStore).isRequired, }).isRequired, }; + +export default injectIntl(PublishDebugLogModal); -- cgit v1.2.3-54-g00ecf