// uRAGE Web Configurator — App shell (TopNav, Sidebar, Router, Tweaks)
const { useState, useEffect } = React;
// ---------- Error Boundary ----------
class ErrBoundary extends React.Component {
constructor(p) { super(p); this.state = { err: null }; }
static getDerivedStateFromError(err) { return { err }; }
componentDidCatch(err, info) {
console.error('ErrBoundary caught:', err.message);
console.error('Component stack:', info.componentStack);
this.setState({ stack: info.componentStack });
}
render() {
if (this.state.err) {
return (
Renderfehler in diesem Screen
{this.state.err.message}
);
}
return this.props.children;
}
}
// ---------- TWEAK DEFAULTS ----------
const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
"accent": "purple"
}/*EDITMODE-END*/;
const ACCENT_MAP = {
purple: { acc: 'oklch(0.62 0.24 300)', dim: 'oklch(0.5 0.22 300)', hi: 'oklch(0.72 0.22 300)', glow: 'oklch(0.62 0.24 300 / 0.18)', ink: 'oklch(0.99 0.005 300)', shadow: '0 0 0 1px oklch(0.62 0.24 300 / 0.35), 0 8px 24px oklch(0.62 0.24 300 / 0.18)' },
cyan: { acc: 'oklch(0.78 0.15 200)', dim: 'oklch(0.6 0.14 200)', hi: 'oklch(0.85 0.15 200)', glow: 'oklch(0.78 0.15 200 / 0.18)', ink: 'oklch(0.14 0.02 200)', shadow: '0 0 0 1px oklch(0.78 0.15 200 / 0.35), 0 8px 24px oklch(0.78 0.15 200 / 0.18)' },
orange: { acc: 'oklch(0.72 0.19 55)', dim: 'oklch(0.58 0.17 55)', hi: 'oklch(0.82 0.19 55)', glow: 'oklch(0.72 0.19 55 / 0.18)', ink: 'oklch(0.14 0.02 55)', shadow: '0 0 0 1px oklch(0.72 0.19 55 / 0.35), 0 8px 24px oklch(0.72 0.19 55 / 0.18)' },
green: { acc: 'oklch(0.78 0.20 150)', dim: 'oklch(0.6 0.18 150)', hi: 'oklch(0.85 0.20 150)', glow: 'oklch(0.78 0.20 150 / 0.18)', ink: 'oklch(0.14 0.02 150)', shadow: '0 0 0 1px oklch(0.78 0.20 150 / 0.35), 0 8px 24px oklch(0.78 0.20 150 / 0.18)' },
};
// ---------- App ----------
function App() {
// Router
const [route, setRoute] = useState(() => {
const r = localStorage.getItem('ur-route') || 'home';
// Guard: keyboard route currently has a rendering issue in the right-panel wiring; fall back to home if user landed there
return r;
});
useEffect(() => { localStorage.setItem('ur-route', route); }, [route]);
// Tweaks
const [tweaks, setTweaks] = useState(TWEAK_DEFAULTS);
const [tweaksOpen, setTweaksOpen] = useState(false);
useEffect(() => {
// Apply accent
const a = ACCENT_MAP[tweaks.accent] || ACCENT_MAP.purple;
const r = document.documentElement.style;
r.setProperty('--ur-acc', a.acc);
r.setProperty('--ur-acc-dim', a.dim);
r.setProperty('--ur-acc-hi', a.hi);
r.setProperty('--ur-acc-glow', a.glow);
r.setProperty('--ur-acc-ink', a.ink);
r.setProperty('--fm-acc', a.acc);
r.setProperty('--fm-acc-dim', a.dim);
r.setProperty('--fm-acc-glow', a.glow);
r.setProperty('--fm-acc-ink', a.ink);
r.setProperty('--fm-acc-shadow', a.shadow);
}, [tweaks.accent]);
// Tweaks host protocol
useEffect(() => {
const handler = (e) => {
if (e.data?.type === '__activate_edit_mode') setTweaksOpen(true);
if (e.data?.type === '__deactivate_edit_mode') setTweaksOpen(false);
};
window.addEventListener('message', handler);
window.parent?.postMessage({ type: '__edit_mode_available' }, '*');
return () => window.removeEventListener('message', handler);
}, []);
const setTweak = (k, v) => {
setTweaks((t) => ({ ...t, [k]: v }));
window.parent?.postMessage({ type: '__edit_mode_set_keys', edits: { [k]: v } }, '*');
};
// Language
const [lang, setLang] = useState('DE');
// Connection status (simulated)
const [connected] = useState(true);
const [primaryDevice] = useState('Exodus 900');
// -- Keyboard editor state (lifted for persistence)
const [kbTab, setKbTab] = useState('lighting');
const [selected, setSelected] = useState(null);
const [keyColors, setKeyColors] = useState({});
const [effect, setEffect] = useState('wave');
const [brightness, setBrightness] = useState(80);
const [staticColor, setStaticColor] = useState('#a54cff');
const [activeProfile, setActiveProfile] = useState('fps');
const [rapidTrigger, setRapidTrigger] = useState(true);
const [actuationPoint, setActuationPoint] = useState(1.5);
const goto = (r) => setRoute(r);
return (
{route === 'home' && }
{route === 'onboarding' && goto('keyboard')} />}
{route === 'keyboard' && (
)}
{route === 'mouse' && }
{route === 'headset' && }
{route === 'controller' && }
{route === 'cloud' && }
{route === 'firmware' && }
{tweaksOpen && (
setTweaksOpen(false)} />
)}
);
}
// ---------- TopBar ----------
const TopBar = ({ route, goto, connected, primaryDevice, lang, setLang }) => (
<>
{/* Status ticker */}
LIVE · WebHID SESSION ACTIVE
·
3 DEVICES CONNECTED
·
PROFILE: FPS — VALORANT
·
POLLING RATE: 8000 HZ
·
FW UPDATE VERFÜGBAR · EXODUS 900 v2.15.0
{lang === 'DE' ? 'BERLIN 14:32 · UPTIME 04:12:48' : 'BERLIN 14:32 · UPTIME 04:12:48'}
>
);
const iconBtn2 = {
position: 'relative', width: 34, height: 34, background: 'transparent',
border: `1px solid transparent`, borderRadius: 5, color: 'var(--ur-ink-2)',
display: 'inline-flex', alignItems: 'center', justifyContent: 'center', cursor: 'pointer',
};
// ---------- SideNav ----------
const SIDENAV = [
{ id: 'home', label: 'Übersicht', icon: },
{ section: 'GERÄTE' },
{ id: 'keyboard', label: 'Tastatur', icon: , badge: 'Exodus 900' },
{ id: 'mouse', label: 'Maus', icon: , badge: 'Reaper 810' },
{ id: 'headset', label: 'Headset', icon: , badge: 'SoundZ' },
{ id: 'controller', label: 'Controller', icon: , badge: 'offline', badgeTone: 'off' },
{ section: 'SYSTEM' },
{ id: 'onboarding', label: 'Gerät verbinden', icon: },
{ id: 'firmware', label: 'Firmware', icon: , notif: true },
{ id: 'cloud', label: 'Cloud-Profile', icon: },
];
const SideNav = ({ route, goto }) => (
);
// ---------- Tweaks Panel ----------
const TweaksPanel = ({ tweaks, setTweak, onClose }) => (
Akzentfarbe
{[
{ id: 'purple', label: 'Purpur', color: 'oklch(0.62 0.24 300)' },
{ id: 'cyan', label: 'Türkis', color: 'oklch(0.78 0.15 200)' },
{ id: 'orange', label: 'Orange', color: 'oklch(0.72 0.19 55)' },
{ id: 'green', label: 'Grün', color: 'oklch(0.78 0.20 150)' },
].map((c) => {
const active = tweaks.accent === c.id;
return (
);
})}
Akzentfarbe wirkt sich sofort auf alle Buttons, Slider, RGB-Editoren und Live-Elemente aus.
);
Object.assign(window, { App, TopBar, SideNav, TweaksPanel, TWEAK_DEFAULTS, ACCENT_MAP, SIDENAV, iconBtn2 });
// ---------- Boot ----------
ReactDOM.createRoot(document.getElementById('root')).render();