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;
|
|
|
|
|
2020-09-06 16:15:25 +00:00
|
|
|
return (
|
|
|
|
<>
|
2020-09-07 15:32:07 +00:00
|
|
|
<Provider i18next={i18n}>
|
|
|
|
<div>
|
2022-06-21 21:42:29 +00:00
|
|
|
<Theme defaultTheme={siteView.map(s => s.site.default_theme)} />
|
|
|
|
{siteView
|
|
|
|
.andThen(s => s.site.icon)
|
|
|
|
.match({
|
|
|
|
some: icon => (
|
|
|
|
<Helmet>
|
|
|
|
<link
|
|
|
|
id="favicon"
|
|
|
|
rel="shortcut icon"
|
|
|
|
type="image/x-icon"
|
|
|
|
href={icon || favIconUrl}
|
|
|
|
/>
|
|
|
|
<link rel="apple-touch-icon" href={icon || favIconPngUrl} />
|
|
|
|
</Helmet>
|
|
|
|
),
|
|
|
|
none: <></>,
|
|
|
|
})}
|
|
|
|
<Navbar siteRes={siteRes} />
|
2020-09-07 15:32:07 +00:00
|
|
|
<div class="mt-4 p-0 fl-1">
|
|
|
|
<Switch>
|
|
|
|
{routes.map(({ path, exact, component: C, ...rest }) => (
|
|
|
|
<Route
|
|
|
|
key={path}
|
|
|
|
path={path}
|
|
|
|
exact={exact}
|
|
|
|
render={props => <C {...props} {...rest} />}
|
|
|
|
/>
|
|
|
|
))}
|
2020-11-10 18:24:47 +00:00
|
|
|
<Route render={props => <NoMatch {...props} />} />
|
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
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|