ErrorBoundary: display user's browser info
This commit is contained in:
parent
284972aa76
commit
4f51f1cea6
|
@ -1,6 +1,7 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import Bowser from 'bowser';
|
||||
|
||||
export default class ErrorBoundary extends React.PureComponent {
|
||||
|
||||
|
@ -45,6 +46,8 @@ export default class ErrorBoundary extends React.PureComponent {
|
|||
}
|
||||
|
||||
render() {
|
||||
const browser = Bowser.getParser(window.navigator.userAgent);
|
||||
|
||||
const { hasError } = this.state;
|
||||
|
||||
if (!hasError) {
|
||||
|
@ -69,6 +72,9 @@ export default class ErrorBoundary extends React.PureComponent {
|
|||
onClick={this.handleCopy}
|
||||
readOnly
|
||||
/>}
|
||||
<p className='error-boundary__browser'>
|
||||
{browser.getBrowserName()} {browser.getBrowserVersion()}
|
||||
</p>
|
||||
<p className='help-text'>
|
||||
<FormattedMessage
|
||||
id='alert.unexpected.help_text'
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
||||
"babel-runtime": "^6.26.0",
|
||||
"blurhash": "^1.0.0",
|
||||
"bowser": "^2.11.0",
|
||||
"browserslist": "^4.16.6",
|
||||
"classnames": "^2.2.5",
|
||||
"compression-webpack-plugin": "^6.0.2",
|
||||
|
|
|
@ -3242,6 +3242,11 @@ boolbase@^1.0.0, boolbase@~1.0.0:
|
|||
resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"
|
||||
integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24=
|
||||
|
||||
bowser@^2.11.0:
|
||||
version "2.11.0"
|
||||
resolved "https://registry.yarnpkg.com/bowser/-/bowser-2.11.0.tgz#5ca3c35757a7aa5771500c70a73a9f91ef420a8f"
|
||||
integrity sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==
|
||||
|
||||
brace-expansion@^1.1.7:
|
||||
version "1.1.11"
|
||||
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
|
||||
|
|
Loading…
Reference in New Issue