import Link from "next/link"; import { answerInvitationAction } from "@/app/actions/orgs"; import { timeAgo } from "@/lib/format"; import { ROLE_INFO } from "@/lib/org-roles"; import type { OrgInvitation } from "@/lib/orgs"; import { ActionButton } from "./action-button"; import { CheckIcon } from "./icons"; import { ListRow } from "./settings-plate"; import { Avatar, avatarUrl, Box, Label } from "./ui"; /** Invitations to join organizations, for the person invited: accept (and land on the organization) or decline. */ export function OrgInvitations({ invitations }: { invitations: OrgInvitation[] }) { if (!invitations.length) return null; return ( {invitations.map((inv) => ( } title={ <> {inv.invitedBy ? `@${inv.invitedBy} invited you to join` : "You’re invited to join"}{" "} {inv.org.username} } meta={ {ROLE_INFO[inv.role].description} Sent {timeAgo(inv.createdAt)}. } > Decline }> Join ))} ); }