| 17 | }; |
| 18 | |
| 19 | function formatRelativeTime(isoStr?: string): string { |
| 20 | if (!isoStr) return "on session start"; |
| 21 | const now = Date.now(); |
| 22 | const target = new Date(isoStr).getTime(); |
| 23 | if (Number.isNaN(target)) return "on session start"; |
| 24 | const diff = target - now; |
| 25 | if (diff <= 0) return "now"; |
| 26 | const sec = Math.floor(diff / 1000); |
| 27 | const min = Math.floor(sec / 60); |
| 28 | const hrs = Math.floor(min / 60); |
| 29 | const days = Math.floor(hrs / 24); |
| 30 | if (days >= 1) return `${days}d`; |
| 31 | if (hrs >= 1) return `${hrs}h${min % 60 > 0 ? ` ${min % 60}m` : ""}`; |
| 32 | if (min >= 1) return `${min}m`; |
| 33 | return "soon"; |
| 34 | } |
| 35 | |
| 36 | interface StatusBarProps { |
| 37 | modelId: string; |