2020-06-29 15:07:05 +00:00
|
|
|
import React, { Suspense, lazy } from "react";
|
|
|
|
import { Router, Route, Switch } from "react-router-dom";
|
|
|
|
import { Loader } from "asc-web-components";
|
2020-08-17 10:16:04 +00:00
|
|
|
import {
|
|
|
|
history,
|
|
|
|
PrivateRoute,
|
|
|
|
PublicRoute,
|
|
|
|
Login,
|
|
|
|
Error404,
|
|
|
|
StudioLayout,
|
|
|
|
Offline,
|
2020-09-07 15:26:44 +00:00
|
|
|
ComingSoon,
|
2020-08-17 10:16:04 +00:00
|
|
|
} from "asc-web-common";
|
2020-06-29 15:07:05 +00:00
|
|
|
|
2020-08-17 10:16:04 +00:00
|
|
|
import Home from "./components/pages/Home";
|
|
|
|
|
|
|
|
const About = lazy(() => import("./components/pages/About"));
|
2020-06-29 15:07:05 +00:00
|
|
|
const Confirm = lazy(() => import("./components/pages/Confirm"));
|
|
|
|
const Settings = lazy(() => import("./components/pages/Settings"));
|
|
|
|
const Wizard = lazy(() => import("./components/pages/Wizard"));
|
|
|
|
|
|
|
|
const App = () => {
|
2020-08-17 10:16:04 +00:00
|
|
|
return navigator.onLine ? (
|
2020-06-29 15:07:05 +00:00
|
|
|
<Router history={history}>
|
|
|
|
<StudioLayout>
|
|
|
|
<Suspense
|
2020-08-17 10:16:04 +00:00
|
|
|
fallback={<Loader className="pageLoader" type="rombs" size="40px" />}
|
2020-06-29 15:07:05 +00:00
|
|
|
>
|
|
|
|
<Switch>
|
2020-07-07 11:50:31 +00:00
|
|
|
<Route exact path="/wizard" component={Wizard} />
|
2020-08-17 10:16:04 +00:00
|
|
|
<PublicRoute
|
|
|
|
exact
|
|
|
|
path={[
|
|
|
|
"/login",
|
|
|
|
"/login/error=:error",
|
2020-09-07 15:26:44 +00:00
|
|
|
"/login/confirmed-email=:confirmedEmail",
|
2020-08-17 10:16:04 +00:00
|
|
|
]}
|
|
|
|
component={Login}
|
|
|
|
/>
|
2020-06-29 15:07:05 +00:00
|
|
|
<Route path="/confirm" component={Confirm} />
|
2020-08-17 10:16:04 +00:00
|
|
|
<PrivateRoute
|
|
|
|
exact
|
|
|
|
path={["/", "/error=:error"]}
|
|
|
|
component={Home}
|
|
|
|
/>
|
2020-06-29 15:07:05 +00:00
|
|
|
<PrivateRoute exact path="/about" component={About} />
|
|
|
|
<PrivateRoute restricted path="/settings" component={Settings} />
|
2020-08-17 10:16:04 +00:00
|
|
|
<PrivateRoute
|
|
|
|
exact
|
|
|
|
path={["/coming-soon"]}
|
|
|
|
component={ComingSoon}
|
|
|
|
/>
|
2020-06-29 15:07:05 +00:00
|
|
|
<PrivateRoute component={Error404} />
|
|
|
|
</Switch>
|
|
|
|
</Suspense>
|
|
|
|
</StudioLayout>
|
2020-08-17 10:16:04 +00:00
|
|
|
</Router>
|
|
|
|
) : (
|
2020-09-07 15:26:44 +00:00
|
|
|
<Offline />
|
|
|
|
);
|
2020-06-29 15:07:05 +00:00
|
|
|
};
|
|
|
|
|
2020-08-17 10:16:04 +00:00
|
|
|
export default App;
|