Faster first load; demo date tags stay current

First load:
- Draw the Overview as soon as the data arrives instead of on its next
  2-second timer tick (about 2.5 s to 0.6 s on a typical connection).
- Start on DOMContentLoaded instead of window.onload.
- Load the ~900 KB PDF library only when someone exports a PDF.
- Fetch the startup files side by side, and build the docs search index
  after the dashboard has drawn (unless the visit starts on /docs).
- Show a loading placeholder on the Overview until the data arrives.

Demo: the date-batch tags sit on fixed working-day offsets from today.
The seed records them in Demo-Dates.json and the worker relabels them when
the day changes, so a long-running container never looks stale.
This commit is contained in:
Johan Sandoval committed 2026-10-07 20:22:09 +00:00
1 parent 5e8dea8027
commit 9731368687
8 files changed
+105 -21

No files matched your search

+11
View File
@@ -30,6 +30,7 @@
let state = { kind: null, arg: null, map: 'left' };
let lastSig = '';
let loaded = false; // set once the dashboard's first data load has finished
// ---------------------------------------------------------------------------------
// Data
@@ -222,9 +223,16 @@
return c;
}
// Shown from the moment the page opens until the first data arrives
function renderSkeleton(root) {
root.innerHTML = '<div class="ov-head"><div><h1 class="ov-title">Overview</h1><p class="ov-subtitle">Loading the fleet...</p></div></div>'
+ '<section class="ov-card ov-skel ov-skel-hero"></section><div class="ov-skel-row"><section class="ov-card ov-skel"></section><section class="ov-card ov-skel"></section></div>';
}
function render() {
const root = document.getElementById('overview-root');
if (!root) return;
if (!loaded) { renderSkeleton(root); return; }
const all = rows();
hideTip();
@@ -663,7 +671,10 @@
renderList: () => renderList()
};
document.addEventListener('usmt:data', () => { loaded = true; });
document.addEventListener('DOMContentLoaded', () => {
maybeRender(true);
setTimeout(() => { if (!loaded) { loaded = true; maybeRender(true); } }, 8000); // never stuck on the placeholder
const orig = window.switchPage;
if (typeof orig === 'function') {
window.switchPage = function (id) {