// Quillpilot — main App
const { useState: useStateApp, useEffect: useEffectApp } = React;
function App() {
const [modal, setModal] = useStateApp(null);
const [toast, setToast] = useStateApp(null);
useEffectApp(() => {
const onKey = (e) => { if (e.key === 'Escape') setModal(null); };
window.addEventListener('keydown', onKey);
return () => window.removeEventListener('keydown', onKey);
}, []);
// smooth scroll for anchor links
useEffectApp(() => {
const onClick = (e) => {
const a = e.target.closest('a[href^="#"]');
if (!a) return;
const href = a.getAttribute('href');
if (href === '#' || href.length < 2) return;
const tgt = document.querySelector(href);
if (tgt) {
e.preventDefault();
const y = tgt.getBoundingClientRect().top + window.scrollY - 24;
window.scrollTo({ top: y, behavior: 'smooth' });
}
};
document.addEventListener('click', onClick);
return () => document.removeEventListener('click', onClick);
}, []);
const onSignup = (email) => {
setToast(`You're on the list — we'll be in touch at ${email}`);
setTimeout(() => setToast(null), 4000);
};
return (
<>