+ {/* Search bar */}
+
+
+
+ setRecipient(e.target.value)}
+ onKeyDown={e => e.key === 'Enter' && load()}
+ className="w-full border rounded-md px-3 py-1.5 text-sm bg-background"
+ />
+
+ {tenants.length > 1 && (
+
+
+
+
+ )}
+ {loaded && policies.length > 0 && (
+
+
+
+
+ )}
+
+
+
+ {/* Tenant summary badges */}
+ {loaded && tenants.length > 0 && (
+
+ {tenants.map(t => (
+
0 ? 'border-yellow-400/40 bg-yellow-500/5 text-yellow-700' :
+ 'border-border bg-muted/30 text-muted-foreground'
+ }`}>
+
+ {t.accountName}
+ {t.error
+ ? error
+ : — {t.count.toLocaleString()}{t.totalCount > t.count ? ` of ${t.totalCount.toLocaleString()}` : ''} held
+ }
+
+ ))}
+
+ )}
+
+ {!loaded && !loading && (
+
+ Click “Load Held Mail” to fetch held messages across all configured Mimecast tenants.
+
+ )}
+
+ {loading && (
+
+
+ Fetching held messages from all tenants…
+
+ )}
+
+ {loaded && !loading && filtered.length === 0 && (
+
+ No held messages found.
+
+ )}
+
+ {loaded && !loading && filtered.length > 0 && (
+
+
+
+ {filtered.length.toLocaleString()} held message{filtered.length !== 1 ? 's' : ''}
+ {data?.totalCount > filtered.length ? ` (showing ${filtered.length} of ${data.totalCount.toLocaleString()} total)` : ''}
+
+
+
+
+
+
+ | Date |
+ To |
+ From |
+ Subject |
+ Policy |
+ {tenants.length > 1 && Tenant | }
+
+
+
+ {filtered.map((m: any) => (
+
+ |
+ {new Date(m.dateReceived).toLocaleString(undefined, { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' })}
+ |
+
+ {m.to}
+ |
+
+ {m.fromDisplay || m.from}
+ {m.fromDisplay && {m.from} }
+ |
+
+ {m.subject || '(no subject)'}
+ |
+
+
+ {m.policyInfo || m.reason || '—'}
+
+ |
+ {tenants.length > 1 && (
+ {m.accountName} |
+ )}
+
+ ))}
+
+
+
+
+ )}
+
+ );
+}
+
// ── Page ──────────────────────────────────────────────────────────────────────
export default function MimecastSyncPage() {
const [statusData, setStatusData] = useState