import { useState } from "react"; import { Clock, Copy, RefreshCw, Timer, Trash2, ShieldAlert } from "lucide-react"; import { Button, Dialog } from "@/client/components/ui"; import type { InboxInfo, TempMailboxTtlHours } from "@/client/lib/api"; const socketColors: Record = { open: "bg-emerald-500", connecting: "bg-yellow-500 animate-pulse", closed: "bg-zinc-500", error: "bg-red-500", idle: "bg-zinc-600", }; interface InboxHeaderProps { address: string; adminMode: boolean; availableExtensions: TempMailboxTtlHours[]; countdown: string; extendingTo: TempMailboxTtlHours | null; inbox: InboxInfo | null; isAdminInspectingTemporaryInbox: boolean; socketState: "idle" | "connecting" | "open" | "closed" | "error"; onCopy: () => void | Promise; onDeleteInbox: () => void | Promise; onExtendInbox: (ttlHours: TempMailboxTtlHours) => void | Promise; onRefresh: () => void | Promise; } export function InboxHeader({ address, adminMode, availableExtensions, countdown, extendingTo, inbox, isAdminInspectingTemporaryInbox, socketState, onCopy, onDeleteInbox, onExtendInbox, onRefresh, }: InboxHeaderProps) { const [confirmDelete, setConfirmDelete] = useState(false); return (
Live Inbox {socketState}

{address}

{inbox?.isPermanent ? ( Permanent inbox ) : countdown ? ( {countdown} ) : ( Loading inbox details... )}
{isAdminInspectingTemporaryInbox ? (

Admin inspection mode: mailbox contents are read-only, but you can delete this temporary inbox.

) : null}
{!adminMode && availableExtensions.map((ttlHours) => ( ))} {inbox && !inbox.isPermanent ? ( ) : null}
setConfirmDelete(false)} title="Delete this inbox?">

This will permanently delete {address} and all its emails. This action cannot be undone.

); }