Watch
0
0
Fork
You've already forked hyperhive
0

frontend: one time wording for the swarm UI and the dashboard, and no HTML strings in the dashboard's busy buttons

fmtAgo, fmtUntil and durationLabel move to @hive/shared/time.js. The swarm UI's util.ts is deleted and its importers (RelativeTime, ReviewRuns, BuildsPage) read the shared module directly. The dashboard's own copies are gone: its fmtAgeSecs (a third phrasing, used for two status lines) becomes the shared fmtAgo, and the dashboard util.js lost fmtAgo, fmtElapsed, epochSec and truncate, which nothing called. asyncBtn and the bulk action buttons mark themselves busy with markBusy: a spinner node before the label and aria-busy, in place of replacing the button's innerHTML with a string (and the label, so the button changed width and lost its name). The el() helper loses its html attribute.
This commit is contained in:
iris 2026-11-19 19:21:15 +01:00
commit 3be4ec069c

View file

@ -7,15 +7,6 @@ import "@hive/shared/hive-warn.js"; // registers <hive-warn> — side-effect imp
// ─── helpers ────────────────────────────────────────────────────────────
export const $ = (id) => document.getElementById(id);
export const fmtAgeSecs = (s) =>
s < 60
? `${s}s`
: s < 3600
? `${Math.floor(s / 60)}m`
: s < 86400
? `${Math.floor(s / 3600)}h`
: `${Math.floor(s / 86400)}d`;
export const esc = (s) =>
String(s).replace(
/[&<>"]/g,
@ -62,11 +53,8 @@ export const form = (
// `asyncBtn` live in `@hive/shared/forms.js`, not here — both the
// dashboard and the per-agent UI import them directly from there.
// `truncate`, `fmtAgo`, `fmtElapsed` + the `paintAtomic`
// render helper live in the dashboard-internal `./util.js`, not here —
// their phrasing ("X running", "X ago") is dashboard-specific, so they
// stay out of the cross-page `common.js` but are shared across the
// dashboard's own tab modules.
// The `paintAtomic` render helper lives in the dashboard-internal `./util.js`;
// relative times ("5m ago") come from `@hive/shared/time.js`.
// ─── shared-worker SSE pipe ─────────────────────────────────────────────
// Returns an EventSource-shaped facade backed by a SharedWorker that