2021-02-22 02:39:04 +00:00
|
|
|
import { Component } from "inferno";
|
|
|
|
import { Helmet } from "inferno-helmet";
|
2021-09-18 14:27:49 +00:00
|
|
|
import { Provider } from "inferno-i18next-dess";
|
2021-07-17 20:42:55 +00:00
|
|
|
import { Route, Switch } from "inferno-router";
|
|
|
|
import { i18n } from "../../i18next";
|
|
|
|
import { routes } from "../../routes";
|
2022-06-21 21:42:29 +00:00
|
|
|
import { favIconPngUrl, favIconUrl, setIsoData } from "../../utils";
|
2021-02-22 02:39:04 +00:00
|
|
|
import { Footer } from "./footer";
|
2021-07-17 20:42:55 +00:00
|
|
|
import { Navbar } from "./navbar";
|
2021-02-22 02:39:04 +00:00
|
|
|
import { NoMatch } from "./no-match";
|
|
|
|
import "./styles.scss";
|
2021-07-17 20:42:55 +00:00
|
|
|
import { Theme } from "./theme";
|
2020-09-06 16:15:25 +00:00
|
|
|
|
2022-06-21 21:42:29 +00:00
|
|
|
export class App extends Component<any, any> {
|
|
|
|
private isoData = setIsoData(this.context);
|
2020-09-06 16:15:25 +00:00
|
|
|
constructor(props: any, context: any) {
|
|
|
|
super(props, context);
|
|
|
|
}
|
|
|
|
render() {
|
2022-06-21 21:42:29 +00:00
|
|
|
let siteRes = this.isoData.site_res;
|
|
|
|
let siteView = siteRes.site_view;
|
2023-01-04 16:56:24 +00:00
|
|
|
let icon = siteView.site.icon;
|
2022-06-21 21:42:29 +00:00
|
|
|
|
2020-09-06 16:15:25 +00:00
|
|
|
return (
|
|
|
|
<>
|
2020-09-07 15:32:07 +00:00
|
|
|
<Provider i18next={i18n}>
|
2022-12-22 21:54:52 +00:00
|
|
|
<div id="app">
|
2022-11-09 19:53:07 +00:00
|
|
|
<Theme defaultTheme={siteView.local_site.default_theme} />
|
2023-01-04 16:56:24 +00:00
|
|
|
{icon && (
|
|
|
|
<Helmet>
|
|
|
|
<link
|
|
|
|
id="favicon"
|
|
|
|
rel="shortcut icon"
|
|
|
|
type="image/x-icon"
|
|
|
|
href={icon || favIconUrl}
|
|
|
|
/>
|
|
|
|
<link rel="apple-touch-icon" href={icon || favIconPngUrl} />
|
|
|
|
</Helmet>
|
|
|
|
)}
|
2022-06-21 21:42:29 +00:00
|
|
|
<Navbar siteRes={siteRes} />
|
2022-09-22 15:03:35 +00:00
|
|
|
<div className="mt-4 p-0 fl-1">
|
2020-09-07 15:32:07 +00:00
|
|
|
<Switch>
|
2023-04-15 14:47:10 +00:00
|
|
|
{routes.map(({ path, component }) => (
|
|
|
|
<Route key={path} path={path} exact component={component} />
|
|
|
|
))}
|
|
|
|
<Route component={NoMatch} />
|
2020-09-07 15:32:07 +00:00
|
|
|
</Switch>
|
|
|
|
</div>
|
2022-06-21 21:42:29 +00:00
|
|
|
<Footer site={siteRes} />
|
2020-09-06 16:15:25 +00:00
|
|
|
</div>
|
2020-09-07 15:32:07 +00:00
|
|
|
</Provider>
|
2020-09-06 16:15:25 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|