mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-11-27 01:02:14 +05:30
#336: add lang attribute for html
This commit is contained in:
parent
3ac62e5eeb
commit
4f38eb2740
2
src/components/user/index.js
Normal file
2
src/components/user/index.js
Normal file
@ -0,0 +1,2 @@
|
||||
// @flow
|
||||
export type { User } from './reducer.js';
|
@ -1,5 +1,18 @@
|
||||
import { UPDATE, SET, CHANGE_LANG } from './actions';
|
||||
|
||||
export type User = {
|
||||
id: number,
|
||||
uuid: string,
|
||||
token: string,
|
||||
username: string,
|
||||
email: string,
|
||||
avatar: string,
|
||||
isGuest: boolean,
|
||||
isActive: boolean,
|
||||
passwordChangedAt: number,
|
||||
hasMojangUsernameCollision: bool,
|
||||
};
|
||||
|
||||
|
||||
const defaults = {
|
||||
id: null,
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { Component, PropTypes } from 'react';
|
||||
import React, { Component } from 'react';
|
||||
|
||||
import { FormattedMessage as Message } from 'react-intl';
|
||||
import { Route, Link, Switch } from 'react-router-dom';
|
||||
import Helmet from 'react-helmet';
|
||||
import classNames from 'classnames';
|
||||
|
||||
import AuthPage from 'pages/auth/AuthPage';
|
||||
@ -9,12 +10,14 @@ import ProfilePage from 'pages/profile/ProfilePage';
|
||||
import RulesPage from 'pages/rules/RulesPage';
|
||||
import PageNotFound from 'pages/404/PageNotFound';
|
||||
|
||||
// @flow
|
||||
import { restoreScroll } from 'functions';
|
||||
import PrivateRoute from 'containers/PrivateRoute';
|
||||
import AuthFlowRoute from 'containers/AuthFlowRoute';
|
||||
import Userbar from 'components/userbar/Userbar';
|
||||
import PopupStack from 'components/ui/popup/PopupStack';
|
||||
import loader from 'services/loader';
|
||||
import type { User } from 'components/user';
|
||||
|
||||
import styles from './root.scss';
|
||||
import messages from './RootPage.intl.json';
|
||||
@ -28,6 +31,15 @@ if (process.env.NODE_ENV === 'production') {
|
||||
}
|
||||
|
||||
class RootPage extends Component {
|
||||
props: {
|
||||
user: User,
|
||||
isPopupActive: boolean,
|
||||
onLogoClick: Function,
|
||||
location: {
|
||||
pathname: string
|
||||
}
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
this.onPageUpdate();
|
||||
}
|
||||
@ -43,12 +55,18 @@ class RootPage extends Component {
|
||||
|
||||
render() {
|
||||
const props = this.props;
|
||||
const {user} = this.props;
|
||||
const isRegisterPage = props.location.pathname === '/register';
|
||||
|
||||
document.body.style.overflow = props.isPopupActive ? 'hidden' : '';
|
||||
if (document && document.body) {
|
||||
document.body.style.overflow = props.isPopupActive ? 'hidden' : '';
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={styles.root}>
|
||||
<Helmet>
|
||||
<html lang={user.lang} />
|
||||
</Helmet>
|
||||
<div id="view-port" className={classNames(styles.viewPort, {
|
||||
[styles.isPopupActive]: props.isPopupActive
|
||||
})}>
|
||||
@ -82,19 +100,6 @@ class RootPage extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
RootPage.displayName = 'RootPage';
|
||||
RootPage.propTypes = {
|
||||
location: PropTypes.shape({
|
||||
pathname: PropTypes.string
|
||||
}).isRequired,
|
||||
user: PropTypes.shape({
|
||||
isGuest: PropTypes.boolean
|
||||
}),
|
||||
children: PropTypes.element,
|
||||
onLogoClick: PropTypes.func.isRequired,
|
||||
isPopupActive: PropTypes.bool.isRequired
|
||||
};
|
||||
|
||||
import { connect } from 'react-redux';
|
||||
import { resetAuth } from 'components/auth/actions';
|
||||
import { withRouter } from 'react-router';
|
||||
|
Loading…
Reference in New Issue
Block a user