light and dark mode fixed and default mode is the default unless you pick Spidey mode
Build & Auto-Repair / build (push) Has been cancelled

This commit is contained in:
2026-06-29 19:28:35 +02:00
parent 7a722a7d7e
commit 98145f0264
5 changed files with 50 additions and 13 deletions
+4 -9
View File
@@ -5,7 +5,6 @@ import { createContext, useContext, useState, useEffect, ReactNode, useCallback
const WEBSITE_THEME_KEY = "crm-website-theme"
const themeClasses: Record<string, string> = {
default: "theme-default",
spidey: "theme-spidey",
}
@@ -43,13 +42,6 @@ export function WebsiteThemeProvider({ children }: { children: ReactNode }) {
const [loading, setLoading] = useState(true)
useEffect(() => {
const stored = getStoredTheme()
if (stored) {
setWebsiteThemeState(stored)
applyWebsiteTheme(stored)
setLoading(false)
return
}
fetch("/api/settings/website-theme")
.then((res) => (res.ok ? res.json() : null))
.then((data) => {
@@ -59,7 +51,10 @@ export function WebsiteThemeProvider({ children }: { children: ReactNode }) {
applyWebsiteTheme(theme)
})
.catch(() => {
applyWebsiteTheme("default")
const stored = getStoredTheme()
const theme = stored || "default"
setWebsiteThemeState(theme)
applyWebsiteTheme(theme)
})
.finally(() => setLoading(false))
}, [])