From c526f6338923ed3fb2a8b5b9bdfb29fe5cfbfb30 Mon Sep 17 00:00:00 2001 From: SleepWalker Date: Fri, 29 Jul 2016 20:55:19 +0300 Subject: [PATCH] #149: create bsod component --- src/components/ui/bsod/BSoD.jsx | 7 +++++++ src/components/ui/bsod/actions.js | 10 ++++++++++ src/components/ui/bsod/reducer.js | 9 +++++++++ src/index.js | 3 ++- src/pages/root/RootPage.jsx | 9 ++++++++- src/reducers.js | 2 ++ 6 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 src/components/ui/bsod/BSoD.jsx create mode 100644 src/components/ui/bsod/actions.js create mode 100644 src/components/ui/bsod/reducer.js diff --git a/src/components/ui/bsod/BSoD.jsx b/src/components/ui/bsod/BSoD.jsx new file mode 100644 index 0000000..256625c --- /dev/null +++ b/src/components/ui/bsod/BSoD.jsx @@ -0,0 +1,7 @@ +import React from 'react'; + +export default function BSoD() { + return ( + + ); +} diff --git a/src/components/ui/bsod/actions.js b/src/components/ui/bsod/actions.js new file mode 100644 index 0000000..feb6a54 --- /dev/null +++ b/src/components/ui/bsod/actions.js @@ -0,0 +1,10 @@ +export const BSOD = 'BSOD'; + +/** + * @return {object} + */ +export function bsod() { + return { + type: BSOD + }; +} diff --git a/src/components/ui/bsod/reducer.js b/src/components/ui/bsod/reducer.js new file mode 100644 index 0000000..0c91c00 --- /dev/null +++ b/src/components/ui/bsod/reducer.js @@ -0,0 +1,9 @@ +import { BSOD } from './actions'; + +export default function(state = false, {type}) { + if (type === BSOD) { + return true; + } + + return state; +} diff --git a/src/index.js b/src/index.js index b1e83d3..a7b665f 100644 --- a/src/index.js +++ b/src/index.js @@ -48,7 +48,8 @@ function restoreScroll() { const viewPort = document.getElementById('view-port'); if (!viewPort) { - throw new Error('Can not find viewPort element'); + console.log('Can not find viewPort element'); + return; } let y = 0; diff --git a/src/pages/root/RootPage.jsx b/src/pages/root/RootPage.jsx index 164f30d..bf56467 100644 --- a/src/pages/root/RootPage.jsx +++ b/src/pages/root/RootPage.jsx @@ -6,6 +6,7 @@ import classNames from 'classnames'; import Userbar from 'components/userbar/Userbar'; import PopupStack from 'components/ui/popup/PopupStack'; +import BSoD from 'components/ui/bsod/BSoD'; import styles from './root.scss'; @@ -22,6 +23,10 @@ if (process.env.NODE_ENV === 'production') { function RootPage(props) { const isRegisterPage = props.location.pathname === '/register'; + if (props.bsod) { + return ; + } + return (
({ + bsod: state.bsod, user: state.user, isPopupActive: state.popup.popups.length > 0 }), { diff --git a/src/reducers.js b/src/reducers.js index b5be66e..90bab89 100644 --- a/src/reducers.js +++ b/src/reducers.js @@ -6,8 +6,10 @@ import auth from 'components/auth/reducer'; import user from 'components/user/reducer'; import i18n from 'components/i18n/reducer'; import popup from 'components/ui/popup/reducer'; +import bsod from 'components/ui/bsod/reducer'; export default combineReducers({ + bsod, auth, user, i18n,