/* Sybilhunt website — app composition + state. */
function App() {
const [how, setHow] = React.useState(false);
const [toast, setToast] = React.useState(false);
const [huntStage, setHuntStage] = React.useState(0);
const deadline = React.useMemo(() => Date.now() + 21 * 86400000 + 9 * 3600000 + 14 * 60000, []);
function scrollTo(id) {
if (id === 'top') { window.scrollTo({ top: 0, behavior: 'smooth' }); return; }
const el = document.getElementById(id);
if (el) {
const y = el.getBoundingClientRect().top + window.pageYOffset - 80;
window.scrollTo({ top: y, behavior: 'smooth' });
}
}
function startHunt() {
setHow(false);
if (window.SHVisitor) {
window.SHVisitor.getRecord().then(function (rec) {
if (rec.onboardingDone) { window.location.href = 'crm.html'; }
else { setHuntStage(1); }
});
return;
}
setHuntStage(1);
}
function acceptHunt() {
setHuntStage(0);
if (window.SHVisitor) window.SHVisitor.setFlag('onboardingDone', true);
window.location.href = 'crm.html';
}
function declineHunt() {
setHuntStage(0);
scrollTo('top');
}
return (
setHow(true)} onStart={startHunt} scrollTo={scrollTo} />
setHow(true)} onStart={startHunt} deadline={deadline} />
setToast(false)} />
);
}
function OnboardingModal({ stage, setStage, onAccept, onDecline }) {
const open = stage > 0;
const close = () => setStage(0);
const blueBtn = {
display: 'inline-flex', alignItems: 'center', justifyContent: 'center', gap: 9,
height: 56, padding: '0 32px', borderRadius: 'var(--radius-pill)', border: 'none', cursor: 'pointer',
background: '#2563EB', color: '#fff', fontFamily: 'var(--font-display)', fontWeight: 600, fontSize: 17,
letterSpacing: '-0.01em', boxShadow: '0 8px 28px rgba(37,99,235,0.32)', transition: 'filter var(--dur-fast)',
};
return (
);
}
function Toast({ show, onClose }) {
return (
Welcome aboard, hunter — your hunt dashboard is being prepared.
);
}
ReactDOM.createRoot(document.getElementById('root')).render();