const React = window.React;
const { useEffect, useRef } = React;
const { Header, Footer, useReveal } = window.NodeItParts;

const CAL_URL = "https://calendly.com/terence-nodeit/30min?primary_color=c879ff";

function ContactApp() {
  useReveal();
  const calRef = useRef(null);
  useEffect(() => {
    let tries = 0;
    const init = () => {
      const el = calRef.current;
      if (window.Calendly && el) {
        el.innerHTML = "";
        window.Calendly.initInlineWidget({ url: CAL_URL, parentElement: el });
      } else if (tries++ < 80) {
        setTimeout(init, 100);
      }
    };
    init();
  }, []);
  return (
    <div className="site">
      <Header />
      <section className="section contact-sec">
        <div className="hero__glow" />
        <div className="container contact-grid">
          <div className="contact-intro reveal is-in">
            <span className="kicker">Contact</span>
            <h1>Prenons 30 minutes ensemble.</h1>
            <p className="hero__lead">Un appel pour diagnostiquer votre besoin, produit, IA ou growth, et vous dire franchement par où commencer. Sans engagement.</p>
            <ul className="contact-list">
              <li><span className="contact-list__mark" aria-hidden="true" />On comprend votre contexte et votre objectif.</li>
              <li><span className="contact-list__mark" aria-hidden="true" />On identifie ce qui crée le plus de valeur, vite.</li>
              <li><span className="contact-list__mark" aria-hidden="true" />On vous propose un premier plan d'action clair.</li>
            </ul>
            <div className="contact-direct">
              <a href="mailto:hello@nodeit.fr">hello@nodeit.fr</a>
              <span>59, rue de Ponthieu, 75008 Paris</span>
            </div>
          </div>
          <div className="contact-cal reveal is-in">
            <div className="contact-cal__frame" ref={calRef} style={{ minWidth: "320px", height: "1080px" }} />
          </div>
        </div>
      </section>
      <Footer />
    </div>
  );
}

window.NodeItContact = ContactApp;
