Menu
Public repository / 42cbcead3f1b5dfa8e3d274c3b18adb25b043b88
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();