AkurAI Build
Menu

Public repository / f7056749a17a422909a828ea639ae776c4e020dc

AkurAI-Platform / frontend/app.js

Latest change 90bd5a7ef0d8c957ea017749826c534cdc77d66f - fix: make service map status honest (AKURAI-PLATFORM-19) by Ólafur Búi Ólafsson

const statusEl = document.getElementById("health");
const root = document.documentElement;
root.classList.add("js");

function isIcelandic() {
  return (root.lang || "is").startsWith("is");
}

async function checkHealth() {
  if (!statusEl) return;

  try {
    const res = await fetch("/api/health", { headers: { accept: "application/json" } });
    if (!res.ok) throw new Error(`status ${res.status}`);
    await res.json();
    statusEl.textContent = isIcelandic() ? "AkurAI-síðan er í loftinu" : "Platform page is live";
    statusEl.dataset.state = "ok";
  } catch {
    statusEl.textContent = isIcelandic() ? "Stöðuathugun mistókst" : "Status check failed";
    statusEl.dataset.state = "fail";
  }
}

function setupReveal() {
  const revealItems = document.querySelectorAll(".motion-copy, .motion-stage, .cat, .feature, .proof-card, .trust-cell, .cta, .sources-section");
  revealItems.forEach((item) => item.setAttribute("data-reveal", ""));

  if (!("IntersectionObserver" in window)) {
    revealItems.forEach((item) => item.classList.add("is-visible"));
    return;
  }

  const observer = new IntersectionObserver((entries) => {
    for (const entry of entries) {
      if (entry.isIntersecting) {
        entry.target.classList.add("is-visible");
        observer.unobserve(entry.target);
      }
    }
  }, { rootMargin: "0px 0px -10% 0px", threshold: 0.12 });

  revealItems.forEach((item) => observer.observe(item));
}

checkHealth();
setupReveal();