2016-07-29 23:25:19 +05:30
|
|
|
import React from 'react';
|
2016-11-12 05:03:12 +05:30
|
|
|
import { FormattedMessage as Message } from 'react-intl';
|
2019-12-08 00:32:00 +05:30
|
|
|
import logger from 'app/services/logger';
|
|
|
|
import appInfo from 'app/components/auth/appInfo/AppInfo.intl.json';
|
2016-11-12 05:03:12 +05:30
|
|
|
|
|
|
|
import styles from './styles.scss';
|
2017-08-10 00:11:35 +05:30
|
|
|
import BoxesField from './BoxesField';
|
|
|
|
import messages from './BSoD.intl.json';
|
2016-11-12 05:03:12 +05:30
|
|
|
|
2019-12-07 16:58:52 +05:30
|
|
|
interface State {
|
|
|
|
lastEventId?: string | void;
|
|
|
|
}
|
|
|
|
|
2016-11-12 14:35:38 +05:30
|
|
|
// TODO: probably it is better to render this view from the App view
|
|
|
|
// to remove dependencies from store and IntlProvider
|
2019-12-07 16:58:52 +05:30
|
|
|
class BSoD extends React.Component<{}, State> {
|
|
|
|
state: State = {};
|
2018-05-02 23:52:13 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
componentDidMount() {
|
|
|
|
// poll for event id
|
|
|
|
const timer = setInterval(() => {
|
|
|
|
if (!logger.getLastEventId()) {
|
|
|
|
return;
|
|
|
|
}
|
2018-05-02 23:52:13 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
clearInterval(timer);
|
2018-05-02 23:52:13 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
this.setState({
|
|
|
|
lastEventId: logger.getLastEventId(),
|
|
|
|
});
|
|
|
|
}, 500);
|
|
|
|
}
|
2018-05-02 23:52:13 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
render() {
|
|
|
|
const { lastEventId } = this.state;
|
2018-05-02 23:52:13 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
let emailUrl = 'mailto:support@ely.by';
|
2018-05-02 23:52:13 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
if (lastEventId) {
|
|
|
|
emailUrl += `?subject=Bug report for #${lastEventId}`;
|
|
|
|
}
|
2018-05-02 23:52:13 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
return (
|
2019-12-26 17:48:58 +05:30
|
|
|
<div className={styles.body}>
|
|
|
|
<canvas
|
|
|
|
className={styles.canvas}
|
|
|
|
ref={(el: HTMLCanvasElement | null) => el && new BoxesField(el)}
|
|
|
|
/>
|
2018-05-02 23:52:13 +05:30
|
|
|
|
2019-12-26 17:48:58 +05:30
|
|
|
<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} />
|
2019-11-27 14:33:32 +05:30
|
|
|
</div>
|
|
|
|
</div>
|
2019-12-26 17:48:58 +05:30
|
|
|
</div>
|
2019-11-27 14:33:32 +05:30
|
|
|
);
|
|
|
|
}
|
2016-07-29 23:25:19 +05:30
|
|
|
}
|
2019-12-07 16:58:52 +05:30
|
|
|
|
|
|
|
export default BSoD;
|