2020-09-06 16:15:25 +00:00
|
|
|
import { Component } from 'inferno';
|
|
|
|
import { Route, Switch } from 'inferno-router';
|
2020-09-07 15:32:07 +00:00
|
|
|
import { Provider } from 'inferno-i18next';
|
2020-09-11 18:09:21 +00:00
|
|
|
import { Helmet } from 'inferno-helmet';
|
2020-09-07 15:32:07 +00:00
|
|
|
import { i18n } from '../i18next';
|
2020-09-06 16:15:25 +00:00
|
|
|
import { routes } from '../../shared/routes';
|
|
|
|
import { Navbar } from '../../shared/components/navbar';
|
|
|
|
import { Footer } from '../../shared/components/footer';
|
|
|
|
import { Symbols } from '../../shared/components/symbols';
|
2020-09-07 03:41:46 +00:00
|
|
|
import { GetSiteResponse } from 'lemmy-js-client';
|
|
|
|
import './styles.scss';
|
2020-09-06 16:15:25 +00:00
|
|
|
|
2020-09-07 03:41:46 +00:00
|
|
|
export interface AppProps {
|
|
|
|
site: GetSiteResponse;
|
|
|
|
}
|
|
|
|
|
|
|
|
export class App extends Component<AppProps, any> {
|
2020-09-06 16:15:25 +00:00
|
|
|
constructor(props: any, context: any) {
|
|
|
|
super(props, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<>
|
2020-09-07 15:32:07 +00:00
|
|
|
<Provider i18next={i18n}>
|
|
|
|
<div>
|
2020-09-15 15:53:48 +00:00
|
|
|
{this.props.site && this.props.site.site.icon && (
|
2020-09-11 18:09:21 +00:00
|
|
|
<Helmet>
|
|
|
|
<link
|
|
|
|
id="favicon"
|
|
|
|
rel="icon"
|
|
|
|
type="image/x-icon"
|
|
|
|
href={this.props.site.site.icon}
|
|
|
|
/>
|
|
|
|
</Helmet>
|
|
|
|
)}
|
2020-09-07 15:32:07 +00:00
|
|
|
<Navbar site={this.props.site} />
|
|
|
|
<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} />}
|
|
|
|
/>
|
|
|
|
))}
|
|
|
|
{/* <Route render={(props) => <NoMatch {...props} />} /> */}
|
|
|
|
</Switch>
|
|
|
|
<Symbols />
|
|
|
|
</div>
|
2020-09-09 03:13:26 +00:00
|
|
|
<Footer site={this.props.site} />
|
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
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|