Skip to content

Commit 7e2c50c

Browse files
fix(teams): color invitation status badges by state (#144)
1 parent a84da7a commit 7e2c50c

1 file changed

Lines changed: 20 additions & 7 deletions

File tree

src/teams-react/components/InvitationsPanel.tsx

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,23 @@ const ASSIGNABLE: { value: WorkspaceRole; label: string }[] = [
2121
{ value: 'admin', label: 'Admin' },
2222
]
2323

24+
const BADGE_BASE = 'inline-flex items-center rounded border px-2 py-0.5 text-[10px] font-medium uppercase'
25+
26+
// Lifecycle status: green = in, amber = awaiting, red = killed, muted = lapsed.
27+
const STATUS_BADGE: Record<InvitationView['status'], string> = {
28+
accepted: 'border-[var(--surface-success-border)] bg-[var(--surface-success-bg)] text-[var(--surface-success-text)]',
29+
pending: 'border-[var(--surface-warning-border)] bg-[var(--surface-warning-bg)] text-[var(--surface-warning-text)]',
30+
revoked: 'border-[var(--surface-danger-border)] bg-[var(--surface-danger-bg)] text-[var(--surface-danger-text)]',
31+
expired: 'border-[var(--border-default)] text-[var(--text-muted)]',
32+
}
33+
34+
// Delivery status: red = bounced, amber = not yet attempted, muted = the normal happy path.
35+
const EMAIL_BADGE: Record<InvitationView['emailStatus'], string> = {
36+
sent: 'border-[var(--border-default)] text-[var(--text-muted)]',
37+
not_sent: 'border-[var(--surface-warning-border)] bg-[var(--surface-warning-bg)] text-[var(--surface-warning-text)]',
38+
failed: 'border-[var(--surface-danger-border)] bg-[var(--surface-danger-bg)] text-[var(--surface-danger-text)]',
39+
}
40+
2441
export function InvitationsPanel({
2542
invitations,
2643
currentRole,
@@ -179,18 +196,14 @@ function InvitationRow({ invitation, canManage, busy, onCopy, onResend, onRevoke
179196
{invitation.permissions} · expires {expiry}
180197
</p>
181198
{emailFailed && (
182-
<p className="mt-1 text-xs text-[var(--text-danger)]">Email was not sent — copy the link to share it.</p>
199+
<p className="mt-1 text-xs text-[var(--surface-danger-text)]">Email was not sent — copy the link to share it.</p>
183200
)}
184201
</div>
185202
<div className="flex shrink-0 items-center gap-2">
186-
<span className="rounded border border-[var(--border-default)] px-2 py-0.5 text-[10px] uppercase text-[var(--text-secondary)]">
203+
<span className={`${BADGE_BASE} ${STATUS_BADGE[invitation.status]}`}>
187204
{invitation.status}
188205
</span>
189-
<span
190-
className={`rounded border border-[var(--border-default)] px-2 py-0.5 text-[10px] uppercase ${
191-
emailFailed ? 'text-[var(--text-danger)]' : 'text-[var(--text-muted)]'
192-
}`}
193-
>
206+
<span className={`${BADGE_BASE} ${EMAIL_BADGE[invitation.emailStatus]}`}>
194207
{invitation.emailStatus.replace('_', ' ')}
195208
</span>
196209
</div>

0 commit comments

Comments
 (0)