// ---------------------------------------------------------------------------
// SP30: "Recent batches" Dashboard widget.
//
// One row per batch the operator parsed recently. Each row tells the
// operator two things at a glance:
// 1. Was this batch clean or did it have a problem? (icon tint +
// `topRejectionReason` line under the filename when present.)
// 2. What was the billed-out outcome? ($ for 837P; payment count for
// 835 ERA batches — the Remittance table has no batch-level
// `total_charge` aggregate.)
//
// Click → onRowClick(id) so the page can navigate to /batches?batch=ID
// (the BatchDrawer deep-link pattern from pages/Batches.tsx).
//
// Reuses the Dashboard "Recent activity" card chrome verbatim (Card +
// CardHeader pb-3 + CardTitle text-[14px] + CardContent pt-0) so the
// widget reads as part of the same family.
// ---------------------------------------------------------------------------
import { Layers, CheckCircle2, AlertTriangle } from "lucide-react";
import type { KeyboardEvent } from "react";
import {
Card,
CardContent,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { fmt } from "@/lib/format";
import type { BatchSummary } from "@/lib/api";
import { cn } from "@/lib/utils";
type Props = {
batches: BatchSummary[];
onRowClick: (batchId: string) => void;
/** Cap shown in the header subtitle. Default 5. */
limit?: number;
};
export function RecentBatchesWidget({ batches, onRowClick, limit = 5 }: Props) {
return (
Recent batches
How the last {limit} batches billed out — sorted newest first.