aboutsummaryrefslogtreecommitdiff
path: root/src/containers/Page/Page.tsx
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-08-15 03:55:27 +0300
committereug-vs <eug-vs@keemail.me>2020-08-15 03:55:27 +0300
commit5ca84ded5a1500ad3ea8d029b71488e8b3b74181 (patch)
tree138464d681b079d5f7a9b52c4868b60ef2129257 /src/containers/Page/Page.tsx
parentbf47681e325e18edb3b5bfa4c655095189697e8b (diff)
downloadwhich-ui-5ca84ded5a1500ad3ea8d029b71488e8b3b74181.tar.gz
feat: ping server before showing content
Diffstat (limited to 'src/containers/Page/Page.tsx')
-rw-r--r--src/containers/Page/Page.tsx30
1 files changed, 9 insertions, 21 deletions
diff --git a/src/containers/Page/Page.tsx b/src/containers/Page/Page.tsx
index 023d86e..475f76d 100644
--- a/src/containers/Page/Page.tsx
+++ b/src/containers/Page/Page.tsx
@@ -2,30 +2,24 @@ import React, { Suspense, useEffect } from 'react';
import { makeStyles, useTheme } from '@material-ui/core/styles';
import { useMediaQuery } from '@material-ui/core';
import { SnackbarProvider } from 'notistack';
-import { Switch, Route, useHistory } from 'react-router-dom';
-import Loading from '../../components/Loading/Loading';
+import { useHistory } from 'react-router-dom';
-const Profile = React.lazy(() => import('../Profile/Profile'));
-const Feed = React.lazy(() => import('../Feed/Feed'));
-const Login = React.lazy(() => import('../Login/Login'));
-const Registration = React.lazy(() => import('../Registration/Registration'));
-const Home = React.lazy(() => import('../Home/Home'));
-const Notifications = React.lazy(() => import('../Notifications/Notifications'));
-const PollCreation = React.lazy(() => import('../PollCreation/PollCreation'));
+import Router from './Router';
+import DynoWaiter from './DynoWaiter';
+import Loading from '../../components/Loading/Loading';
const useStyles = makeStyles(theme => ({
root: {
[theme.breakpoints.down('sm')]: {
- margin: theme.spacing(10, 0, 12, 0)
+ padding: theme.spacing(10, 0, 12, 0)
},
[theme.breakpoints.up('md')]: {
- margin: theme.spacing(15, 5, 8, 5)
+ padding: theme.spacing(15, 5, 8, 5)
}
}
}));
-
const Page: React.FC = () => {
const classes = useStyles();
const theme = useTheme();
@@ -49,15 +43,9 @@ const Page: React.FC = () => {
>
<div className={classes.root}>
<Suspense fallback={<Loading />}>
- <Switch>
- <Route exact path="/" component={Home} />
- <Route exact path="/login" component={Login} />
- <Route exact path="/registration" component={Registration} />
- <Route exact path="/feed" component={Feed} />
- <Route exact path="/notifications" component={Notifications} />
- <Route exact path="/new" component={PollCreation} />
- <Route path="/profile/:username" component={Profile} />
- </Switch>
+ <DynoWaiter>
+ <Router />
+ </DynoWaiter>
</Suspense>
</div>
</SnackbarProvider>