| 121 | const GENERIC_INVITE_ERROR = "Failed to send invitation. Please try again."; |
| 122 | |
| 123 | function formatLastActive(lastActiveAt: string | null): string { |
| 124 | if (!lastActiveAt) return "—"; |
| 125 | const date = new Date(lastActiveAt); |
| 126 | const diffMins = Math.floor((Date.now() - date.getTime()) / 60000); |
| 127 | if (diffMins < 1) return "Just now"; |
| 128 | if (diffMins < 60) return `${diffMins}m ago`; |
| 129 | const diffHours = Math.floor(diffMins / 60); |
| 130 | if (diffHours < 24) return `${diffHours}h ago`; |
| 131 | const diffDays = Math.floor(diffHours / 24); |
| 132 | if (diffDays < 30) return `${diffDays}d ago`; |
| 133 | return date.toLocaleDateString(undefined, { month: "short", day: "numeric" }); |
| 134 | } |
| 135 | |
| 136 | export function OrgPage(props: { |
| 137 | domainsSection?: React.ReactNode; |