mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-11-19 06:32:58 +05:30
#149: create bsod component
This commit is contained in:
parent
927c80abce
commit
c526f63389
7
src/components/ui/bsod/BSoD.jsx
Normal file
7
src/components/ui/bsod/BSoD.jsx
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
export default function BSoD() {
|
||||||
|
return (
|
||||||
|
<img src="https://i.ytimg.com/vi/_aT9r3ZFErY/maxresdefault.jpg" width="100%" height="100%" />
|
||||||
|
);
|
||||||
|
}
|
10
src/components/ui/bsod/actions.js
Normal file
10
src/components/ui/bsod/actions.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
export const BSOD = 'BSOD';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {object}
|
||||||
|
*/
|
||||||
|
export function bsod() {
|
||||||
|
return {
|
||||||
|
type: BSOD
|
||||||
|
};
|
||||||
|
}
|
9
src/components/ui/bsod/reducer.js
Normal file
9
src/components/ui/bsod/reducer.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { BSOD } from './actions';
|
||||||
|
|
||||||
|
export default function(state = false, {type}) {
|
||||||
|
if (type === BSOD) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return state;
|
||||||
|
}
|
@ -48,7 +48,8 @@ function restoreScroll() {
|
|||||||
const viewPort = document.getElementById('view-port');
|
const viewPort = document.getElementById('view-port');
|
||||||
|
|
||||||
if (!viewPort) {
|
if (!viewPort) {
|
||||||
throw new Error('Can not find viewPort element');
|
console.log('Can not find viewPort element');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let y = 0;
|
let y = 0;
|
||||||
|
@ -6,6 +6,7 @@ import classNames from 'classnames';
|
|||||||
|
|
||||||
import Userbar from 'components/userbar/Userbar';
|
import Userbar from 'components/userbar/Userbar';
|
||||||
import PopupStack from 'components/ui/popup/PopupStack';
|
import PopupStack from 'components/ui/popup/PopupStack';
|
||||||
|
import BSoD from 'components/ui/bsod/BSoD';
|
||||||
|
|
||||||
import styles from './root.scss';
|
import styles from './root.scss';
|
||||||
|
|
||||||
@ -22,6 +23,10 @@ if (process.env.NODE_ENV === 'production') {
|
|||||||
function RootPage(props) {
|
function RootPage(props) {
|
||||||
const isRegisterPage = props.location.pathname === '/register';
|
const isRegisterPage = props.location.pathname === '/register';
|
||||||
|
|
||||||
|
if (props.bsod) {
|
||||||
|
return <BSoD />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.root}>
|
<div className={styles.root}>
|
||||||
<div id="view-port" className={classNames(styles.viewPort, {
|
<div id="view-port" className={classNames(styles.viewPort, {
|
||||||
@ -56,14 +61,16 @@ RootPage.propTypes = {
|
|||||||
pathname: PropTypes.string
|
pathname: PropTypes.string
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
children: PropTypes.element,
|
children: PropTypes.element,
|
||||||
|
bsod: PropTypes.bool.isRequired,
|
||||||
logout: PropTypes.func.isRequired,
|
logout: PropTypes.func.isRequired,
|
||||||
isPopupActive: PropTypes.bool
|
isPopupActive: PropTypes.bool.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { logout } from 'components/user/actions';
|
import { logout } from 'components/user/actions';
|
||||||
|
|
||||||
export default connect((state) => ({
|
export default connect((state) => ({
|
||||||
|
bsod: state.bsod,
|
||||||
user: state.user,
|
user: state.user,
|
||||||
isPopupActive: state.popup.popups.length > 0
|
isPopupActive: state.popup.popups.length > 0
|
||||||
}), {
|
}), {
|
||||||
|
@ -6,8 +6,10 @@ import auth from 'components/auth/reducer';
|
|||||||
import user from 'components/user/reducer';
|
import user from 'components/user/reducer';
|
||||||
import i18n from 'components/i18n/reducer';
|
import i18n from 'components/i18n/reducer';
|
||||||
import popup from 'components/ui/popup/reducer';
|
import popup from 'components/ui/popup/reducer';
|
||||||
|
import bsod from 'components/ui/bsod/reducer';
|
||||||
|
|
||||||
export default combineReducers({
|
export default combineReducers({
|
||||||
|
bsod,
|
||||||
auth,
|
auth,
|
||||||
user,
|
user,
|
||||||
i18n,
|
i18n,
|
||||||
|
Loading…
Reference in New Issue
Block a user