DocSpace-buildtools/web/ASC.Web.Client/src/App.js

64 lines
1.8 KiB
JavaScript
Raw Normal View History

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,
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>
<Route exact path="/wizard" component={Wizard} />
2020-08-17 10:16:04 +00:00
<PublicRoute
exact
path={[
"/login",
"/login/error=:error",
"/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>
) : (
<Offline />
);
2020-06-29 15:07:05 +00:00
};
2020-08-17 10:16:04 +00:00
export default App;