diff --git a/src/components/ui/bsod/BSoD.js b/src/components/ui/bsod/BSoD.js index 3eac3d5..7113159 100644 --- a/src/components/ui/bsod/BSoD.js +++ b/src/components/ui/bsod/BSoD.js @@ -1,9 +1,8 @@ // @flow import React from 'react'; - import { FormattedMessage as Message } from 'react-intl'; - import { IntlProvider } from 'components/i18n'; +import logger from 'services/logger'; import appInfo from 'components/auth/appInfo/AppInfo.intl.json'; import styles from './styles.scss'; @@ -12,32 +11,64 @@ import messages from './BSoD.intl.json'; // TODO: probably it is better to render this view from the App view // to remove dependencies from store and IntlProvider -export default function BSoD({store}: {store: *}) { - return ( - -
- el && new BoxesField(el)} - /> +export default class BSoD extends React.Component<{ + store: Object +}, { + lastEventId?: string, +}> { + state = {}; -
-
- -
-
- -
-
- -
- - support@ely.by - -
- + componentDidMount() { + // poll for event id + const timer = setInterval(() => { + if (!logger.getLastEventId()) { + return; + } + + clearInterval(timer); + + this.setState({ + lastEventId: logger.getLastEventId() + }); + }, 500); + } + + render() { + const {store} = this.props; + const {lastEventId} = this.state; + + let emailUrl = 'mailto:support@ely.by'; + + if (lastEventId) { + emailUrl += `?subject=Bug report for #${lastEventId}`; + } + + return ( + +
+ el && new BoxesField(el)} + /> + +
+
+ +
+
+ +
+
+ +
+ + support@ely.by + +
+ +
-
- - ); + + ); + } } diff --git a/src/services/logger/logger.js b/src/services/logger/logger.js index 32f0149..20944b5 100644 --- a/src/services/logger/logger.js +++ b/src/services/logger/logger.js @@ -66,6 +66,10 @@ class Logger { warn(message: string | Error, context: Object) { log('warning', message, context); } + + getLastEventId(): string | void { + return Raven.lastEventId(); + } } function log(