| 148 | const GENERIC_INVITE_ERROR = "Failed to send invitation. Please try again."; |
| 149 | |
| 150 | function formatLastActive(lastActiveAt: string | null): string { |
| 151 | if (!lastActiveAt) return "—"; |
| 152 | const date = new Date(lastActiveAt); |
| 153 | const diffMins = Math.floor((Date.now() - date.getTime()) / 60000); |
| 154 | if (diffMins < 1) return "Just now"; |
| 155 | if (diffMins < 60) return `${diffMins}m ago`; |
| 156 | const diffHours = Math.floor(diffMins / 60); |
| 157 | if (diffHours < 24) return `${diffHours}h ago`; |
| 158 | const diffDays = Math.floor(diffHours / 24); |
| 159 | if (diffDays < 30) return `${diffDays}d ago`; |
| 160 | return date.toLocaleDateString(undefined, { month: "short", day: "numeric" }); |
| 161 | } |
| 162 | |
| 163 | export function OrgPage(props: { |
| 164 | domainsSection?: React.ReactNode; |