Web Client: refactoring
This commit is contained in:
parent
a1c4a8a9f5
commit
5542e211df
@ -1,37 +1,63 @@
|
||||
import React, { Suspense, lazy } from "react";
|
||||
import { Router, Route, Switch } from "react-router-dom";
|
||||
import { Loader } from "asc-web-components";
|
||||
import { history, PrivateRoute, PublicRoute, Login, Error404, StudioLayout, Offline, ComingSoon} from "asc-web-common";
|
||||
import About from "./components/pages/About";
|
||||
import {
|
||||
history,
|
||||
PrivateRoute,
|
||||
PublicRoute,
|
||||
Login,
|
||||
Error404,
|
||||
StudioLayout,
|
||||
Offline,
|
||||
ComingSoon
|
||||
} from "asc-web-common";
|
||||
|
||||
const Home = lazy(() => import("./components/pages/Home"));
|
||||
import Home from "./components/pages/Home";
|
||||
|
||||
const About = lazy(() => import("./components/pages/About"));
|
||||
const Confirm = lazy(() => import("./components/pages/Confirm"));
|
||||
const Settings = lazy(() => import("./components/pages/Settings"));
|
||||
const Wizard = lazy(() => import("./components/pages/Wizard"));
|
||||
|
||||
const App = () => {
|
||||
return (
|
||||
navigator.onLine ?
|
||||
return navigator.onLine ? (
|
||||
<Router history={history}>
|
||||
<StudioLayout>
|
||||
<Suspense
|
||||
fallback={<Loader className="pageLoader" type="rombs" size='40px' />}
|
||||
fallback={<Loader className="pageLoader" type="rombs" size="40px" />}
|
||||
>
|
||||
<Switch>
|
||||
<Route exact path="/wizard" component={Wizard} />
|
||||
<PublicRoute exact path={["/login","/login/error=:error", "/login/confirmed-email=:confirmedEmail"]} component={Login} />
|
||||
<PublicRoute
|
||||
exact
|
||||
path={[
|
||||
"/login",
|
||||
"/login/error=:error",
|
||||
"/login/confirmed-email=:confirmedEmail"
|
||||
]}
|
||||
component={Login}
|
||||
/>
|
||||
<Route path="/confirm" component={Confirm} />
|
||||
<PrivateRoute exact path={["/","/error=:error"]} component={Home} />
|
||||
<PrivateRoute
|
||||
exact
|
||||
path={["/", "/error=:error"]}
|
||||
component={Home}
|
||||
/>
|
||||
<PrivateRoute exact path="/about" component={About} />
|
||||
<PrivateRoute restricted path="/settings" component={Settings} />
|
||||
<PrivateRoute exact path={["/coming-soon"]} component={ComingSoon} />
|
||||
<PrivateRoute
|
||||
exact
|
||||
path={["/coming-soon"]}
|
||||
component={ComingSoon}
|
||||
/>
|
||||
<PrivateRoute component={Error404} />
|
||||
</Switch>
|
||||
</Suspense>
|
||||
</StudioLayout>
|
||||
</Router> :
|
||||
<Offline/>
|
||||
</Router>
|
||||
) : (
|
||||
<Offline />
|
||||
);
|
||||
};
|
||||
|
||||
export default App;
|
||||
export default App;
|
||||
|
@ -7,7 +7,6 @@ import styled from "styled-components";
|
||||
import { Trans } from "react-i18next";
|
||||
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
//const path = require("path");
|
||||
const i18n = createI18N({
|
||||
page: "About",
|
||||
localesPath: "pages/About"
|
||||
|
@ -6,7 +6,6 @@ import { I18nextProvider } from "react-i18next";
|
||||
import { Error404, utils } from "asc-web-common";
|
||||
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
//const path = require("path");
|
||||
const i18n = createI18N({
|
||||
page: "Confirm",
|
||||
localesPath: "pages/Confirm"
|
||||
|
Loading…
Reference in New Issue
Block a user