Enable bsod for testing and fixed errors due to lack of intl context

This commit is contained in:
SleepWalker 2016-11-12 11:05:38 +02:00 committed by ErickSkrauch
parent 70dbf2ea6a
commit c4eacca87d
4 changed files with 27 additions and 21 deletions

View File

@ -2,31 +2,36 @@ import React from 'react';
import { FormattedMessage as Message } from 'react-intl'; import { FormattedMessage as Message } from 'react-intl';
import { IntlProvider } from 'components/i18n';
import appInfo from 'components/auth/appInfo/AppInfo.intl.json'; import appInfo from 'components/auth/appInfo/AppInfo.intl.json';
import messages from './BSoD.intl.json'; import messages from './BSoD.intl.json';
import styles from './styles.scss'; import styles from './styles.scss';
export default function BSoD() { // 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}) {
return ( return (
<div className={styles.body}> <IntlProvider store={store}>
<div className={styles.wrapper}> <div className={styles.body}>
<div className={styles.title}> <div className={styles.wrapper}>
<Message {...appInfo.appName} /> <div className={styles.title}>
</div> <Message {...appInfo.appName} />
<div className={styles.lineWithMargin}> </div>
<Message {...messages.criticalErrorHappened} /> <div className={styles.lineWithMargin}>
</div> <Message {...messages.criticalErrorHappened} />
<div className={styles.line}> </div>
<Message {...messages.reloadPageOrContactUs} /> <div className={styles.line}>
</div> <Message {...messages.reloadPageOrContactUs} />
<a href="mailto:support@ely.by" className={styles.support}> </div>
support@ely.by <a href="mailto:support@ely.by" className={styles.support}>
</a> support@ely.by
<div className={styles.easterEgg}> </a>
<Message {...messages.alsoYouCanInteractWithBackground}/> <div className={styles.easterEgg}>
<Message {...messages.alsoYouCanInteractWithBackground}/>
</div>
</div> </div>
</div> </div>
</div> </IntlProvider>
); );
} }

View File

@ -12,7 +12,7 @@ export default function dispatchBsod(store = injectedStore) {
onBsod && onBsod(); onBsod && onBsod();
ReactDOM.render( ReactDOM.render(
<BSoD />, <BSoD store={store} />,
document.getElementById('app') document.getElementById('app')
); );
} }

View File

@ -20,6 +20,8 @@ logger.init({
sentryCdn: window.SENTRY_CDN sentryCdn: window.SENTRY_CDN
}); });
import dispatchBsod from 'components/ui/bsod/dispatchBsod'; // TODO: remove after tests
const store = storeFactory(); const store = storeFactory();
bsodFactory(store, stopLoading); bsodFactory(store, stopLoading);
@ -47,6 +49,7 @@ Promise.all([
<Router history={browserHistory} onUpdate={() => { <Router history={browserHistory} onUpdate={() => {
restoreScroll(); restoreScroll();
stopLoading(); stopLoading();
setTimeout(dispatchBsod, 0); // TODO: remove after tests
}}> }}>
{routesFactory(store)} {routesFactory(store)}
</Router> </Router>

View File

@ -11,8 +11,6 @@ import ActivationState from './ActivationState';
import CompleteState from './CompleteState'; import CompleteState from './CompleteState';
import ResendActivationState from './ResendActivationState'; import ResendActivationState from './ResendActivationState';
import dispatchBsod from 'components/ui/bsod/dispatchBsod';
export default class AuthFlow { export default class AuthFlow {
constructor(actions) { constructor(actions) {
if (typeof actions !== 'object') { if (typeof actions !== 'object') {