import type { WebhookSummary } from "@/contracts"; import { ExternalLink, GitBranch, GitCommitHorizontal, History } from "lucide-react"; import { Link } from "react-router-dom"; import { Badge, Dialog, EmptyState } from "@/client/components/ui"; import { formatRelativeTime } from "@/client/lib"; import { DELIVERY_OUTCOME_META } from "@/client/components/webhooks/webhook-presentation"; import { webhookProviderCatalog } from "@/lib/webhooks"; interface DeliveryListDialogProps { open: boolean; onClose: () => void; webhook: WebhookSummary; } export const DeliveryListDialog = ({ open, onClose, webhook }: DeliveryListDialogProps) => { const catalog = webhookProviderCatalog[webhook.provider]; const deliveries = webhook.recentDeliveries; return ( } > {deliveries.length === 0 ? ( } title="No deliveries yet" description="Deliveries will appear here once the provider sends a webhook." /> ) : (
{deliveries.map((delivery) => { const meta = DELIVERY_OUTCOME_META[delivery.outcome]; const commitDisplay = delivery.commitSha ? delivery.commitSha.slice(0, 7) : null; return (
{meta.label} {delivery.eventName} {formatRelativeTime(delivery.receivedAt)}
{delivery.branch ? ( {delivery.branch} ) : null} {commitDisplay ? ( {commitDisplay} ) : null} {delivery.runId ? ( View run ) : null}
); })}
)}
); };