(ts: number)
| 151 | } |
| 152 | |
| 153 | function relativeTime(ts: number): string { |
| 154 | const seconds = Math.floor((Date.now() - ts) / 1000) |
| 155 | if (seconds < 60) return 'just now' |
| 156 | const minutes = Math.floor(seconds / 60) |
| 157 | if (minutes < 60) return `${minutes}m ago` |
| 158 | const hours = Math.floor(minutes / 60) |
| 159 | if (hours < 24) return `${hours}h ago` |
| 160 | return `${Math.floor(hours / 24)}d ago` |
| 161 | } |
| 162 | |
| 163 | /** |
| 164 | * Owns the thread catalog in localStorage. This is the layer the persistence |