mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +10:00
fix: themes
This commit is contained in:
@ -5,10 +5,17 @@ import { detect, fromHtmlTag } from '@lingui/detect-locale';
|
||||
import { I18nProvider } from '@lingui/react';
|
||||
import { hydrateRoot } from 'react-dom/client';
|
||||
import { HydratedRouter } from 'react-router/dom';
|
||||
import { Theme, ThemeProvider } from 'remix-themes';
|
||||
import { match } from 'ts-pattern';
|
||||
|
||||
import { dynamicActivate } from '@documenso/lib/utils/i18n';
|
||||
|
||||
async function main() {
|
||||
const theme = match(document.documentElement.getAttribute('data-theme'))
|
||||
.with('dark', () => Theme.DARK)
|
||||
.with('light', () => Theme.LIGHT)
|
||||
.otherwise(() => null);
|
||||
|
||||
const locale = detect(fromHtmlTag('lang')) || 'en';
|
||||
|
||||
await dynamicActivate(locale);
|
||||
@ -18,7 +25,9 @@ async function main() {
|
||||
document,
|
||||
<StrictMode>
|
||||
<I18nProvider i18n={i18n}>
|
||||
<HydratedRouter />
|
||||
<ThemeProvider specifiedTheme={theme} themeAction="/api/theme">
|
||||
<HydratedRouter />
|
||||
</ThemeProvider>
|
||||
</I18nProvider>
|
||||
</StrictMode>,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user