mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-25 06:30:00 +05:30
Add event id for BSOD email url
This commit is contained in:
parent
aaad2006ab
commit
993dd4dbb5
@ -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 (
|
||||
<IntlProvider store={store}>
|
||||
<div className={styles.body}>
|
||||
<canvas className={styles.canvas}
|
||||
ref={(el: ?HTMLCanvasElement) => el && new BoxesField(el)}
|
||||
/>
|
||||
export default class BSoD extends React.Component<{
|
||||
store: Object
|
||||
}, {
|
||||
lastEventId?: string,
|
||||
}> {
|
||||
state = {};
|
||||
|
||||
<div className={styles.wrapper}>
|
||||
<div className={styles.title}>
|
||||
<Message {...appInfo.appName} />
|
||||
</div>
|
||||
<div className={styles.lineWithMargin}>
|
||||
<Message {...messages.criticalErrorHappened} />
|
||||
</div>
|
||||
<div className={styles.line}>
|
||||
<Message {...messages.reloadPageOrContactUs} />
|
||||
</div>
|
||||
<a href="mailto:support@ely.by" className={styles.support}>
|
||||
support@ely.by
|
||||
</a>
|
||||
<div className={styles.easterEgg}>
|
||||
<Message {...messages.alsoYouCanInteractWithBackground}/>
|
||||
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 (
|
||||
<IntlProvider store={store}>
|
||||
<div className={styles.body}>
|
||||
<canvas className={styles.canvas}
|
||||
ref={(el: ?HTMLCanvasElement) => el && new BoxesField(el)}
|
||||
/>
|
||||
|
||||
<div className={styles.wrapper}>
|
||||
<div className={styles.title}>
|
||||
<Message {...appInfo.appName} />
|
||||
</div>
|
||||
<div className={styles.lineWithMargin}>
|
||||
<Message {...messages.criticalErrorHappened} />
|
||||
</div>
|
||||
<div className={styles.line}>
|
||||
<Message {...messages.reloadPageOrContactUs} />
|
||||
</div>
|
||||
<a href={emailUrl} className={styles.support}>
|
||||
support@ely.by
|
||||
</a>
|
||||
<div className={styles.easterEgg}>
|
||||
<Message {...messages.alsoYouCanInteractWithBackground}/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</IntlProvider>
|
||||
);
|
||||
</IntlProvider>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -66,6 +66,10 @@ class Logger {
|
||||
warn(message: string | Error, context: Object) {
|
||||
log('warning', message, context);
|
||||
}
|
||||
|
||||
getLastEventId(): string | void {
|
||||
return Raven.lastEventId();
|
||||
}
|
||||
}
|
||||
|
||||
function log(
|
||||
|
Loading…
Reference in New Issue
Block a user