Web Client: refactoring

This commit is contained in:
Alexey Safronov 2020-08-17 13:16:04 +03:00
parent a1c4a8a9f5
commit 5542e211df
3 changed files with 38 additions and 14 deletions

View File

@ -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;

View File

@ -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"

View File

@ -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"