lemmy-ui/src/shared/components/app.tsx

63 lines
1.8 KiB
TypeScript
Raw Normal View History

import { Component } from 'inferno';
import { Route, Switch } from 'inferno-router';
import { Provider } from 'inferno-i18next';
2020-09-11 18:09:21 +00:00
import { Helmet } from 'inferno-helmet';
import { i18n } from '../i18next';
2020-11-10 18:24:47 +00:00
import { routes } from '../routes';
import { Navbar } from './navbar';
import { Footer } from './footer';
import { NoMatch } from './no-match';
2020-10-26 14:28:17 +00:00
import { Theme } from './theme';
2020-11-10 18:24:47 +00:00
import { Symbols } from './symbols';
import { GetSiteResponse } from 'lemmy-js-client';
import './styles.scss';
export interface AppProps {
site: GetSiteResponse;
}
export class App extends Component<AppProps, any> {
constructor(props: any, context: any) {
super(props, context);
}
render() {
return (
<>
<Provider i18next={i18n}>
<div>
2020-10-26 14:28:17 +00:00
<Theme user={this.props.site.my_user} />
2020-09-15 15:55:38 +00:00
{this.props.site &&
this.props.site.site &&
this.props.site.site.icon && (
<Helmet>
<link
id="favicon"
rel="icon"
type="image/x-icon"
href={this.props.site.site.icon}
/>
</Helmet>
)}
<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} />}
/>
))}
2020-11-10 18:24:47 +00:00
<Route render={props => <NoMatch {...props} />} />
</Switch>
<Symbols />
</div>
2020-09-09 03:13:26 +00:00
<Footer site={this.props.site} />
</div>
</Provider>
</>
);
}
}