WFDASH-WEBAPP/src/components/theme-bootstrap.tsx
SJCoetz 7a68cafe35 chore: add logos, opencode config and build assets
This commit includes the temporary Next.js build cache files, public brand
logos, and project configuration added in this change.
2026-07-27 08:21:20 +02:00

22 lines
714 B
XML

/**
* Inline script that runs in <head> before hydration.
*
* Reads the persisted theme id from localStorage and applies it to
* <html> so the user never sees a flash of the default theme.
*
* MUST stay dependency-free — it's bundled as a string and inlined.
*/
export function ThemeBootstrapScript() {
const code = `
(function() {
try {
var themeId = localStorage.getItem('wfdash-theme') || 'wfdash';
var root = document.documentElement;
root.setAttribute('data-theme', themeId);
} catch (e) {
// localStorage may be blocked — fall back to the SSR-rendered theme
}
})();
`;
return <script dangerouslySetInnerHTML={{ __html: code }} />;
}