};
initializeSite(site);
- const user = site.my_user;
- const userTheme =
- user &&
- user.theme &&
- `
- <link
- rel="stylesheet"
- type="text/css"
- href="/static/assets/css/themes/${user.theme}.min.css"
- />
- `;
const wrapper = (
<StaticRouter location={req.url} context={isoData}>
${helmet.title.toString()}
${helmet.meta.toString()}
- ${helmet.link.toString()}
<!-- Required meta tags -->
<meta name="Description" content="Lemmy">
<!-- Styles -->
<link rel="stylesheet" type="text/css" href="/static/styles/styles.css" />
- ${
- userTheme ??
- `
- <link rel="stylesheet" type="text/css" href="/static/assets/css/themes/litely.min.css" id="default-light" media="(prefers-color-scheme: light)" />
- <link rel="stylesheet" type="text/css" href="/static/assets/css/themes/darkly.min.css" id="default-dark" media="(prefers-color-scheme: no-preference), (prefers-color-scheme: dark)" />
- `.trim()
- }
+
+ <!-- Current theme and more -->
+ ${helmet.link.toString()}
</head>
<body ${helmet.bodyAttributes.toString()}>
import { routes } from '../../shared/routes';
import { Navbar } from '../../shared/components/navbar';
import { Footer } from '../../shared/components/footer';
+import { Theme } from './theme';
import { Symbols } from '../../shared/components/symbols';
import { GetSiteResponse } from 'lemmy-js-client';
-import { UserService } from '../../shared/services';
import './styles.scss';
export interface AppProps {
<>
<Provider i18next={i18n}>
<div>
+ <Theme user={this.props.site.my_user} />
{this.props.site &&
this.props.site.site &&
this.props.site.site.icon && (
--- /dev/null
+import { User } from 'lemmy-js-client';
+import { Helmet } from 'inferno-helmet';
+
+export const Theme = (props: { user: User | undefined }) => {
+ const user = props.user;
+ const userTheme = user && user.theme && (
+ <link
+ rel="stylesheet"
+ type="text/css"
+ href={`/static/assets/css/themes/${user.theme}.min.css`}
+ />
+ );
+
+ return (
+ <Helmet>
+ {userTheme ?? (
+ <>
+ <link
+ rel="stylesheet"
+ type="text/css"
+ href="/static/assets/css/themes/litely.min.css"
+ id="default-light"
+ media="(prefers-color-scheme: light)"
+ />
+ <link
+ rel="stylesheet"
+ type="text/css"
+ href="/static/assets/css/themes/darkly.min.css"
+ id="default-dark"
+ media="(prefers-color-scheme: no-preference), (prefers-color-scheme: dark)"
+ />
+ </>
+ )}
+ </Helmet>
+ );
+};