import React from "react"; import { cn } from "@/lib/utils"; import { formatCurrency } from "@/lib/format-currency"; import { formatDateShort } from "@/lib/format-date"; import { Button } from "@/components/ui/button"; /** * Loan draft selector shown on the "Select application to continue" screen. * Two variants (BUILD-1612): * - Multi-draft: grid of cards — consumer renders when loans.length > 1 * - Single-draft: consumer can skip this screen entirely when loans.length === 1 * * This component always renders the grid. The caller decides whether to show it. */ export type LoanCardApplicant = { name: string; isMain: boolean; }; export type LoanCardItem = { id: string; /** ISO date string */ createdAt: string; desiredLoanAmount?: number; isJoint: boolean; applicants: LoanCardApplicant[]; }; export type LoanApplicationCardsProps = { loans: LoanCardItem[]; onSelect: (id: string) => void; onBack: () => void; companyName?: string; className?: string; }; export function LoanApplicationCards({ loans, onSelect, onBack, companyName, className, }: LoanApplicationCardsProps) { return (
{/* Header */}

Select an application to continue

Tip: Get technical and broker support by visiting the support section within the app

{/* Section */}

What loan application would you like to continue?

{/* Card grid */}
{loans.map((loan) => (
{/* Meta: date + company */}
Started{" "} {formatDateShort(loan.createdAt)}
{companyName && ( {companyName} )}
{/* Loan amount */}
Loan Amount {formatCurrency(loan.desiredLoanAmount ?? 0)}

{/* Applicant type + names */}
{loan.isJoint ? "Joint Application" : "Individual Application"} {loan.applicants.map((a) => ( {a.name} {loan.isJoint && ( {" "} ({a.isMain ? "Main Applicant" : "Co-Applicant"}) )} ))}
))}
); } function CalendarIcon() { return ( ); }