feat(web): richer active-job rows on The Floor (source/format/tracks, stage, elapsed, error)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,20 @@ const STATE_MAP: Record<string, { label: string; kind: Kind }> = {
|
||||
needs_attention: { label: "Needs attention", kind: "attention" },
|
||||
};
|
||||
|
||||
/** Compact elapsed label from an ISO/Date string to `now` (ms since epoch). */
|
||||
export function timeAgo(value: string | Date | null | undefined, now: number): string {
|
||||
if (!value) return "";
|
||||
const t = new Date(value).getTime();
|
||||
if (Number.isNaN(t)) return "";
|
||||
const s = Math.max(0, Math.floor((now - t) / 1000));
|
||||
if (s < 60) return "just now";
|
||||
const m = Math.floor(s / 60);
|
||||
if (m < 60) return `${m}m`;
|
||||
const h = Math.floor(m / 60);
|
||||
if (h < 24) return `${h}h`;
|
||||
return `${Math.floor(h / 24)}d`;
|
||||
}
|
||||
|
||||
export function describeJob(
|
||||
state: string,
|
||||
stage: string,
|
||||
|
||||
Reference in New Issue
Block a user