/* ============================================================
NeuralScout — Tweaks panel
============================================================ */
function Tweaks({ values, onChange }) {
const [open, setOpen] = React.useState(true);
const [visible, setVisible] = React.useState(false);
React.useEffect(() => {
const onMsg = (e) => {
if (e.data?.type === '__activate_edit_mode') setVisible(true);
if (e.data?.type === '__deactivate_edit_mode') setVisible(false);
};
window.addEventListener('message', onMsg);
window.parent.postMessage({type: '__edit_mode_available'}, '*');
return () => window.removeEventListener('message', onMsg);
}, []);
const set = (key, val) => {
onChange({ ...values, [key]: val });
window.parent.postMessage({type:'__edit_mode_set_keys', edits: { [key]: val }}, '*');
};
if (!visible) return null;
const accents = [
['Cyan', '#22e3ff', '#22e3ff26'],
['Lime', '#b6f569', '#b6f56922'],
['Amber', '#ffb547', '#ffb54722'],
['Violet', '#b794ff', '#b794ff22'],
['Coral', '#ff6b6b', '#ff6b6b22'],
];
return (
setOpen(o => !o)}>
TWEAKS
{open ? '–' : '+'}
{open && (
set('theme', v)} />
{accents.map(([n,c,s]) => (
set('motion', v)} />
set('headline', v)} />
set('featLayout', v)} />
)}
);
}
function Row({ label, children }) {
return (
{label}
{children}
);
}
function Seg({ opts, val, onClick }) {
return (
{opts.map(([label, v]) => (
))}
);
}
const tweakStyles = {
panel: {
position:'fixed', bottom: 20, right: 20, zIndex: 100,
width: 280,
background:'rgba(11,14,19,0.92)',
backdropFilter:'blur(12px)',
border:'1px solid var(--ns-line-2)',
borderRadius: 8,
boxShadow:'0 20px 60px rgba(0,0,0,0.6)',
},
head: {
padding:'10px 14px', cursor:'pointer',
display:'flex', justifyContent:'space-between', alignItems:'center',
borderBottom:'1px solid var(--ns-line)',
},
body: {
padding:'14px', display:'flex', flexDirection:'column', gap: 12,
},
};
window.Tweaks = Tweaks;