PR feedback

This commit is contained in:
Orvar Segerström 2020-10-26 19:42:07 +01:00
parent b8a47be3df
commit 397db2f1db
2 changed files with 41 additions and 34 deletions

View file

@ -1,8 +1,14 @@
import { User } from 'lemmy-js-client'; import { User } from 'lemmy-js-client';
import { Helmet } from 'inferno-helmet'; import { Helmet } from 'inferno-helmet';
import { Component } from 'inferno';
export const Theme = (props: { user: User | undefined }) => { interface Props {
const user = props.user; user: User | undefined;
}
export class Theme extends Component<Props> {
render() {
const { user } = this.props;
const userTheme = user && user.theme && ( const userTheme = user && user.theme && (
<link <link
rel="stylesheet" rel="stylesheet"
@ -33,4 +39,5 @@ export const Theme = (props: { user: User | undefined }) => {
)} )}
</Helmet> </Helmet>
); );
}; }
}

View file

@ -3,7 +3,7 @@ import { UserService } from './services';
import { i18n } from './i18next'; import { i18n } from './i18next';
import { getLanguage } from './utils'; import { getLanguage } from './utils';
export const initializeSite = (site: GetSiteResponse) => { export function initializeSite(site: GetSiteResponse) {
UserService.Instance.user = site.my_user; UserService.Instance.user = site.my_user;
i18n.changeLanguage(getLanguage()); i18n.changeLanguage(getLanguage());
}; }