/* global React, useTweaks, TweaksPanel, TweakSection, TweakSelect, TweakRadio, TweakToggle */ const HERO_LABEL = { 'Command Center': 'a', 'Blueprint Schematic': 'b', 'Boot Sequence': 'c', 'Radar Scope': 'd', 'Data Stream': 'e' }; const HERO_REV = { a: 'Command Center', b: 'Blueprint Schematic', c: 'Boot Sequence', d: 'Radar Scope', e: 'Data Stream' }; // motion + grid persist across visits; hero + signal are randomized per load by site.js const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{ "motion": "Full", "grid": true }/*EDITMODE-END*/; function applyMotion(m) { document.body.classList.toggle('calm', m === 'Restrained'); } function applyGrid(on) { document.body.classList.toggle('nogrid', !on); } const A = () => window.AegisSite || {}; function Island() { const [t, setTweak] = useTweaks(TWEAK_DEFAULTS); // hero + signal initialise from whatever site.js randomly applied this visit const [hero, setHero] = React.useState(() => HERO_REV[A().getHero && A().getHero()] || 'Command Center'); const [signal, setSignal] = React.useState(() => (A().getSignal && A().getSignal()) || 'Cyan'); React.useEffect(() => { A().setHero && A().setHero(HERO_LABEL[hero] || 'a'); }, [hero]); React.useEffect(() => { A().setSignal && A().setSignal(signal); }, [signal]); React.useEffect(() => { applyMotion(t.motion); }, [t.motion]); React.useEffect(() => { applyGrid(t.grid); }, [t.grid]); function shuffle() { const heroes = ['Command Center', 'Blueprint Schematic', 'Boot Sequence', 'Radar Scope', 'Data Stream']; const hues = ['Cyan', 'Azure', 'Violet', 'Jade', 'Amber']; setHero(heroes[Math.floor(Math.random() * heroes.length)]); setSignal(hues[Math.floor(Math.random() * hues.length)]); } return ( setTweak('motion', v)} /> setTweak('grid', v)} />

Layout + hue are randomised each visit. Motion + grid are remembered.

); } (function mount() { const root = document.getElementById('tweaks-root'); if (root && window.ReactDOM) ReactDOM.createRoot(root).render(); })();