/* global React, ReactDOM */ /* Tweaks panel for ANEX site — controls accent + light/dark mode. Loaded on every page; the panel itself is governed by tweaks-panel.jsx host protocol. */ const { useState, useEffect } = React; const ACCENTS = [ { name: 'Clinical teal', hex: '#3B8C95' }, { name: 'Indigo', hex: '#4F62D6' }, { name: 'Sage', hex: '#6B8E7A' }, { name: 'Plum', hex: '#8E5A8A' }, { name: 'Brick', hex: '#B85A4A' }, { name: 'Slate', hex: '#3E4A5A' }, ]; function AnexTweaks() { const [theme, setTheme] = useState(() => window.AnexSite.getTheme()); const [accent, setAccent] = useState(() => { const cur = window.AnexSite.getAccent().toUpperCase(); return ACCENTS.find(a => a.hex.toUpperCase() === cur)?.hex || cur; }); useEffect(() => { window.AnexSite.setTheme(theme); }, [theme]); useEffect(() => { window.AnexSite.setAccent(accent); }, [accent]); return (
{ACCENTS.map(a => { const isActive = a.hex.toUpperCase() === accent.toUpperCase(); return ( ); })}
setAccent(e.target.value.toUpperCase())} style={{ width: 28, height: 28, padding: 0, border: '1px solid #DCD7CB', borderRadius: 6, background: 'transparent' }} /> custom {accent.toUpperCase()}
Toggle dark mode and pick an accent across the entire site. Choices persist across pages.
); } const root = ReactDOM.createRoot(document.getElementById('tweaks-root')); root.render();