diff --git a/lyra/web/static/index.html b/lyra/web/static/index.html index df4682b..cc525fc 100644 --- a/lyra/web/static/index.html +++ b/lyra/web/static/index.html @@ -3,7 +3,7 @@ Lyra Core Chat - + @@ -252,13 +252,33 @@ } }); } + // Only show the stack quick-logger when a poker session is actually live — + // otherwise logging just errors ("no live session"). + function updateStackQuickVisibility() { + const box = document.getElementById("stackQuick"); + if (!box) return; + fetch("/session/data", { cache: "no-store" }) + .then(function (r) { return r.json(); }) + .then(function (data) { + const live = !!(data && data.session && data.session.is_live); + box.style.display = live ? "flex" : "none"; + }) + .catch(function () { box.style.display = "none"; }); + } (function wireStackQuick() { + const box = document.getElementById("stackQuick"); const btn = document.getElementById("stackQuickBtn"); const inp = document.getElementById("stackQuickInput"); + if (box) box.style.display = "none"; // hidden until a live session is confirmed if (btn) btn.addEventListener("click", stackQuickLog); if (inp) inp.addEventListener("keydown", function (e) { if (e.key === "Enter") { e.preventDefault(); stackQuickLog(); } }); + updateStackQuickVisibility(); + setInterval(updateStackQuickVisibility, 10000); + document.addEventListener("visibilitychange", function () { + if (!document.hidden) updateStackQuickVisibility(); + }); })(); function generateSessionId() {