/* global React, Eyebrow, Icon, ImageUpload, api */
const { useState: useStateSS, useEffect: useEffectSS } = React;
function SiteSettings({ onChanged }){
const [config, setConfig] = useStateSS(null);
const [loading, setLoading] = useStateSS(true);
const [busy, setBusy] = useStateSS(false);
const [okMsg, setOkMsg] = useStateSS("");
const [errMsg, setErrMsg] = useStateSS("");
useEffectSS(() => {
let mounted = true;
api.getSiteConfig().then(r => {
if (!mounted) return;
setConfig(r.data || { id: "main" });
setLoading(false);
});
return () => { mounted = false; };
}, []);
if (loading) return
Loading…
;
const set = (k,v) => setConfig(c => ({...c, [k]: v}));
const save = async () => {
setOkMsg(""); setErrMsg("");
setBusy(true);
try {
const patch = {
hero_video_url: config.hero_video_url || null,
founder_name: config.founder_name || null,
founder_photo_url: config.founder_photo_url || null,
founder_video_url: config.founder_video_url || null,
founder_video_title: config.founder_video_title || null,
};
const r = await api.updateSiteConfig(patch);
setBusy(false);
if (r.error) { setErrMsg(r.error.message || "Save failed."); return; }
setOkMsg("Saved.");
onChanged && onChanged();
setTimeout(() => setOkMsg(""), 2400);
} catch (e) {
setBusy(false);
setErrMsg(e.message || "Save failed — please try again.");
}
};
const igShortcode = config.hero_video_url ? api.instagramShortcode(config.hero_video_url) : null;
return (
SITE SETTINGS
Marketing page content
These settings control what visitors see on the marketing homepage — the hero video, founder section, etc.
Paste an Instagram reel URL. This plays inside the phone mockup on the hero section.
set("hero_video_url", v)} placeholder="https://www.instagram.com/reel/…"/>
{igShortcode && (
)}
set("founder_name", v)} placeholder="Kevis"/>
set("founder_photo_url", v)} rounded/>
set("founder_video_url", v)} placeholder="https://youtube.com/watch?v=… or https://www.loom.com/share/…"/>
set("founder_video_title", v)} placeholder="How Clippr works (2 min)"/>
{errMsg &&
{errMsg}
}
{okMsg &&
{okMsg}
}
);
}
function SSCard({title, children}){
return (
{title}
{children}
);
}
function SSField({label, value, onChange, placeholder}){
return (
);
}
window.SiteSettings = SiteSettings;