dev #6
@@ -7,7 +7,13 @@
|
||||
<title>Cluedo Sheet</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@400;700&family=IM+Fell+English:ital@0;1&display=swap" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@400;700&family=IM+Fell+English:ital@0;1&display=swap" rel="stylesheet">
|
||||
<script>
|
||||
try {
|
||||
const k = localStorage.getItem("hpTheme:guest") || "default";
|
||||
document.documentElement.setAttribute("data-theme", k);
|
||||
} catch {}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
@@ -342,6 +342,14 @@ export default function App() {
|
||||
setThemeKey(key);
|
||||
applyTheme(key);
|
||||
|
||||
// ✅ sofort für nächsten Start merken (verhindert Flash)
|
||||
try {
|
||||
localStorage.setItem(`hpTheme:${(me?.email || "guest").toLowerCase()}`, key);
|
||||
localStorage.setItem("hpTheme:guest", key); // fallback, falls noch nicht eingeloggt
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
|
||||
try {
|
||||
await api("/auth/theme", {
|
||||
method: "PATCH",
|
||||
@@ -351,6 +359,7 @@ export default function App() {
|
||||
// theme locally already applied; ignore backend error
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// ===== Stats (always fresh on open) =====
|
||||
const openStatsModal = async () => {
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
import React from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import ReactDOM from "react-dom/client";
|
||||
import App from "./App.jsx";
|
||||
import { applyTheme, DEFAULT_THEME_KEY } from "./styles/themes";
|
||||
import { registerSW } from "virtual:pwa-register";
|
||||
|
||||
createRoot(document.getElementById("root")).render(<App />);
|
||||
try {
|
||||
const key = localStorage.getItem("hpTheme:guest") || DEFAULT_THEME_KEY;
|
||||
applyTheme(key);
|
||||
} catch {
|
||||
applyTheme(DEFAULT_THEME_KEY);
|
||||
}
|
||||
|
||||
ReactDOM.createRoot(document.getElementById("root")).render(<App />);
|
||||
registerSW({ immediate: true });
|
||||
const updateSW = registerSW({
|
||||
immediate: true,
|
||||
|
||||
Reference in New Issue
Block a user