// Small presentation helpers shared across pages. // trunc shortens a long hex key to head…tail for dense tables, keeping enough // to recognize it while staying copy-friendly via the full value in a tooltip. export function trunc(s: string, head = 10, tail = 6): string { if (!s) return ""; if (s.length <= head + tail + 1) return s; return `${s.slice(0, head)}…${s.slice(-tail)}`; } // fmtTime renders an RFC3339 / ISO timestamp as a compact local datetime, or // returns the raw string when it is not parseable. export function fmtTime(s: string): string { if (!s) return "—"; const d = new Date(s); if (Number.isNaN(d.getTime())) return s; return d.toLocaleString(); }