Misc fixes and additions
Some checks failed
Automated Container Build / build-and-push (push) Failing after 8s
Some checks failed
Automated Container Build / build-and-push (push) Failing after 8s
This commit is contained in:
parent
724d70e58b
commit
02eefdac0e
9 changed files with 311 additions and 65 deletions
|
|
@ -14,6 +14,21 @@ export default function RootLayout({
|
|||
return (
|
||||
<html lang="en" data-theme="dark" suppressHydrationWarning>
|
||||
<head>
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
(function() {
|
||||
try {
|
||||
var theme = localStorage.getItem('theme');
|
||||
if (theme === 'light') {
|
||||
document.documentElement.setAttribute('data-theme', 'light');
|
||||
document.documentElement.style.setProperty('color-scheme', 'light');
|
||||
}
|
||||
} catch (e) {}
|
||||
})();
|
||||
`,
|
||||
}}
|
||||
/>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="anonymous" />
|
||||
<link
|
||||
|
|
|
|||
|
|
@ -25,6 +25,19 @@ export default function Home() {
|
|||
|
||||
if (api.isAuthenticated()) {
|
||||
setState('app');
|
||||
// Load and apply saved theme from API
|
||||
try {
|
||||
const data = await api.getSettings();
|
||||
const s = data.settings || data;
|
||||
const theme = s.theme || 'dark';
|
||||
document.documentElement.setAttribute('data-theme', theme);
|
||||
document.documentElement.style.setProperty('color-scheme', theme);
|
||||
if (theme === 'light') document.documentElement.classList.remove('dark');
|
||||
else document.documentElement.classList.add('dark');
|
||||
localStorage.setItem('theme', theme);
|
||||
} catch {
|
||||
// Theme sync is non-critical
|
||||
}
|
||||
} else {
|
||||
setState('login');
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue