All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 12s
- Sidebar: dynamic brand-accent colors, brainstorm section restyled - AI chat general: popup panel with expand/collapse, hides when contextual AI open - AI chat contextual: tabs reordered (Actions first), X close button, height fix - Settings: all tabs restyled, 6 new color presets (sage, terracotta, iron, etc.) - Global color cleanup: emerald/orange hardcoded → brand-accent dynamic - Brainstorm page: orange → brand-accent throughout - PageEntry animation component added to key pages - Floating AI button: bg-brand-accent instead of hardcoded black - i18n: all 15 locales updated with new AI/billing keys - Billing: freemium quota tracking, BYOK, stripe subscription scaffolding - Admin: integrated into new design - AGENTS.md + CLAUDE.md project rules added
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
/**
|
||
* Script inline exécuté avant l’hydratation : même logique que `applyDocumentTheme`.
|
||
*/
|
||
import { normalizeThemeId } from './apply-document-theme'
|
||
|
||
export function getThemeScript(serverTheme: string = 'light') {
|
||
const fallback = normalizeThemeId(serverTheme)
|
||
return `
|
||
(function() {
|
||
try {
|
||
var fallback = ${JSON.stringify(fallback)};
|
||
var stored = localStorage.getItem('theme-preference');
|
||
var raw = stored || fallback;
|
||
if (raw === 'slate') raw = 'light';
|
||
var allowed = { light:1, dark:1, auto:1, sepia:1, midnight:1, rose:1, green:1, lavender:1, sand:1, ocean:1, sunset:1, blue:1 };
|
||
var theme = allowed[raw] ? raw : 'light';
|
||
var root = document.documentElement;
|
||
root.classList.remove('dark');
|
||
root.removeAttribute('data-theme');
|
||
if (theme === 'auto') {
|
||
if (window.matchMedia('(prefers-color-scheme: dark)').matches) root.classList.add('dark');
|
||
} else if (theme === 'dark') {
|
||
root.classList.add('dark');
|
||
} else if (theme === 'light') {
|
||
/* :root papier */
|
||
} else {
|
||
root.setAttribute('data-theme', theme);
|
||
if (theme === 'midnight') root.classList.add('dark');
|
||
}
|
||
var accentStored = localStorage.getItem('accent-color');
|
||
if (accentStored) root.style.setProperty('--color-brand-accent', accentStored);
|
||
} catch (e) {
|
||
console.error('Theme script error', e);
|
||
}
|
||
})();
|
||
`.trim()
|
||
}
|