Added loading page — SSE-driven splash screen for first-run UX

This commit is contained in:
Virgílio Santos
2026-03-14 15:47:09 -03:00
parent 15b4568140
commit 1933e063ae
4 changed files with 114 additions and 11 deletions

View File

@@ -1058,14 +1058,8 @@ document.addEventListener('DOMContentLoaded', () => {
.then(r => r.json())
.then(data => { D = data; init(); connectSSE(); })
.catch(() => {
// API not ready yetuse inline data as fallback if available
if (D && D.meta) { init(); }
else { document.getElementById('bootLines').innerHTML = '<div style="color:var(--warn)">Waiting for first sweep...</div>'; }
// Retry after a delay
setTimeout(() => {
fetch('/api/data').then(r => r.json()).then(data => { D = data; init(); connectSSE(); }).catch(() => {});
}, 10000);
connectSSE();
// Should not reach here — server routes to loading.html when no data
if (D && D.meta) { init(); connectSSE(); }
});
} else if (D && D.meta) {
// File mode: use inline data