"use client"; import { Badge } from "@/components/ui/badge"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@/components/ui/table"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { Send } from "lucide-react"; import type { SendHistoryRow } from "@/types/telegram.types"; interface BotSendsTabProps { history: SendHistoryRow[]; } function statusBadge(status: string) { switch (status) { case "SENT": return Sent; case "SENDING": return Sending; case "PENDING": return Pending; case "FAILED": return Failed; default: return {status}; } } export function BotSendsTab({ history }: BotSendsTabProps) { return (
Bot Send History
Recent package deliveries via the Telegram bot.
{history.length === 0 ? (
No sends yet. Use the “Send to Telegram” button on a package to get started.
) : (
Package Recipient Status Requested Completed {history.map((row) => ( {row.packageName} {row.recipientName ?? "—"}
{statusBadge(row.status)} {row.error && ( {row.error} )}
{new Date(row.createdAt).toLocaleString()} {row.completedAt ? new Date(row.completedAt).toLocaleString() : "—"}
))}
)}
); }