Move MobileFrame to app.js to prevent multiple instances

This commit is contained in:
Mikko Koski 2017-03-23 15:22:19 +02:00
parent 1f103a82f9
commit 6280d2da79
2 changed files with 22 additions and 21 deletions

View file

@ -7,7 +7,7 @@ import { IntlProvider, addLocaleData } from 'react-intl';
import en from 'react-intl/locale-data/en';
import configureStore from './store';
import Routes from './Routes';
import { RoutesProvider } from './components';
import { RoutesProvider, MobileFrame } from './components';
import routesConfiguration from './routesConfiguration';
import { flattenRoutes } from './util/routes';
import localeData from './translations/en.json';
@ -21,7 +21,9 @@ export const ClientApp = props => {
<Provider store={store}>
<RoutesProvider flattenedRoutes={flattenedRoutes}>
<BrowserRouter>
<Routes />
<MobileFrame>
<Routes />
</MobileFrame>
</BrowserRouter>
</RoutesProvider>
</Provider>
@ -42,7 +44,9 @@ export const ServerApp = props => {
<Provider store={store}>
<RoutesProvider flattenedRoutes={flattenedRoutes}>
<StaticRouter location={url} context={context}>
<Routes />
<MobileFrame>
<Routes />
</MobileFrame>
</StaticRouter>
</RoutesProvider>
</Provider>

View file

@ -4,7 +4,6 @@ import Helmet from 'react-helmet';
import { withRouter } from 'react-router-dom';
import { FormattedMessage } from 'react-intl';
import { Topbar } from '../../containers';
import { MobileFrame } from '../../components';
const scrollToTop = () => {
// Todo: this might need fine tuning later
@ -37,23 +36,21 @@ class PageLayout extends Component {
/* eslint-enable no-console */
return (
<MobileFrame>
<div className={className}>
<Helmet title={title} />
{authInfoError
? <div style={{ color: 'red' }}>
<FormattedMessage id="PageLayout.authInfoFailed" />
</div>
: null}
{logoutError
? <div style={{ color: 'red' }}>
<FormattedMessage id="PageLayout.logoutFailed" />
</div>
: null}
<Topbar />
{children}
</div>
</MobileFrame>
<div className={className}>
<Helmet title={title} />
{authInfoError
? <div style={{ color: 'red' }}>
<FormattedMessage id="PageLayout.authInfoFailed" />
</div>
: null}
{logoutError
? <div style={{ color: 'red' }}>
<FormattedMessage id="PageLayout.logoutFailed" />
</div>
: null}
<Topbar />
{children}
</div>
);
}
}