import React, { useEffect, useState } from "../../../recovery-preview/node_modules/react/index.js"; import { compactText, requestJson, } from "../../runtime/client.js"; // Wot: Wrapper structure for the config page function Wot({ children }) { return
{children}
; } // Hot: Header component for sections or the page function Hot({ title, description }) { return (

Theme Customization

{title}

{description}

); } // zot: Setting Item (Zone) component for form fields function zot({ label, children, span = 1 }) { return (
{children}
); } // QKt: The main Nebula configuration component function QKt() { const [loading, setLoading] = useState(true); const [saving, setSaving] = useState(false); const [form, setForm] = useState({ nebula_theme_color: 'aurora', nebula_hero_slogan: '', nebula_welcome_target: '', nebula_register_title: '', nebula_background_url: '', nebula_metrics_base_url: '', nebula_default_theme_mode: 'system', nebula_light_logo_url: '', nebula_dark_logo_url: '', nebula_custom_html: '', nebula_static_cdn_url: '', }); const [error, setError] = useState(""); const [success, setSuccess] = useState(""); useEffect(() => { (async () => { try { const payload = await requestJson("/config/fetch?key=nebula"); if (payload?.nebula) { setForm(prev => ({ ...prev, ...payload.nebula })); } } catch (err) { setError("Failed to load configuration: " + err.message); } finally { setLoading(false); } })(); }, []); const handleSave = async (e) => { e.preventDefault(); setSaving(true); setSuccess(""); setError(""); try { await requestJson("/config/save", { method: "POST", body: form, }); setSuccess("Nebula configuration updated successfully."); window.scrollTo({ top: 0, behavior: 'smooth' }); } catch (err) { setError("Failed to save configuration: " + err.message); } finally { setSaving(false); } }; if (loading) return
Initializing Nebula settings...
; return ( {error &&
{error}
} {success &&
{success}
}
setForm({...form, nebula_hero_slogan: e.target.value})} placeholder="Main visual headline" /> setForm({...form, nebula_welcome_target: e.target.value})} placeholder="Name displayed after WELCOME TO" /> setForm({...form, nebula_register_title: e.target.value})} placeholder="Title on registration panel" /> setForm({...form, nebula_background_url: e.target.value})} placeholder="Direct link to background image" /> setForm({...form, nebula_metrics_base_url: e.target.value})} placeholder="https://stats.example.com" /> setForm({...form, nebula_light_logo_url: e.target.value})} placeholder="Logo for light mode" /> setForm({...form, nebula_dark_logo_url: e.target.value})} placeholder="Logo for dark mode" /> setForm({...form, nebula_static_cdn_url: e.target.value})} placeholder="e.g. https://cdn.example.com/nebula (no trailing slash)" />