From 397db2f1db5a069dcefc9a077040317894759b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orvar=20Segerstr=C3=B6m?= Date: Mon, 26 Oct 2020 19:42:07 +0100 Subject: [PATCH] PR feedback --- src/shared/components/theme.tsx | 71 ++++++++++++++++++--------------- src/shared/initialize.ts | 4 +- 2 files changed, 41 insertions(+), 34 deletions(-) diff --git a/src/shared/components/theme.tsx b/src/shared/components/theme.tsx index 558f9a8b..a1e0a01f 100644 --- a/src/shared/components/theme.tsx +++ b/src/shared/components/theme.tsx @@ -1,36 +1,43 @@ import { User } from 'lemmy-js-client'; import { Helmet } from 'inferno-helmet'; +import { Component } from 'inferno'; -export const Theme = (props: { user: User | undefined }) => { - const user = props.user; - const userTheme = user && user.theme && ( - - ); +interface Props { + user: User | undefined; +} - return ( - - {userTheme ?? ( - <> - - - - )} - - ); -}; +export class Theme extends Component { + render() { + const { user } = this.props; + const userTheme = user && user.theme && ( + + ); + + return ( + + {userTheme ?? ( + <> + + + + )} + + ); + } +} diff --git a/src/shared/initialize.ts b/src/shared/initialize.ts index 555da5e3..de5762db 100644 --- a/src/shared/initialize.ts +++ b/src/shared/initialize.ts @@ -3,7 +3,7 @@ import { UserService } from './services'; import { i18n } from './i18next'; import { getLanguage } from './utils'; -export const initializeSite = (site: GetSiteResponse) => { +export function initializeSite(site: GetSiteResponse) { UserService.Instance.user = site.my_user; i18n.changeLanguage(getLanguage()); -}; +}