fix(ui): distinguish loading, failed and empty lists, one role label set, en dash for no value

This commit is contained in:
sam committed 2026-10-18 15:54:31 +11:00
1 parent ac60445bf8
commit aae8dafdd7
16 files changed
+95 -46

No files matched your search

+3 -3
View File
@@ -5,10 +5,10 @@
/** Humanised relative time: "2 min ago". Raw timestamps make people do maths. */
export function ago(value: string | number | Date | null | undefined): string {
if (!value) return "—";
if (!value) return "–";
const then = value instanceof Date ? value : new Date(value);
const secs = Math.floor((Date.now() - then.getTime()) / 1000);
if (!Number.isFinite(secs)) return "—";
if (!Number.isFinite(secs)) return "–";
if (secs < 45) return "just now";
const units: Array<[string, number]> = [
["min", 60],
@@ -27,7 +27,7 @@ export function ago(value: string | number | Date | null | undefined): string {
/** Compact number: 2_400_000 -> "2.4M". Long digit strings do not scan. */
export function compact(n: number | null | undefined): string {
if (n == null || Number.isNaN(n)) return "—";
if (n == null || Number.isNaN(n)) return "–";
return new Intl.NumberFormat(undefined, {
notation: "compact",
maximumFractionDigits: 1,