import { Link2, Link2Off, Loader2, RefreshCw } from 'lucide-react'; import { cn, fmtDate } from '@/lib/utils'; import { Button } from '@/components/ui/button'; import BillMerchantRules from '@/components/BillMerchantRules'; import { transactionTitle, transactionDate, fmtTransactionAmount } from '@/components/bill-modal/transactionDisplay'; // Bank-matching rules (with a Sync-now action) + the list of transactions // confirmed as matched to this bill (each with an Unmatch action). Presentational // — the parent owns the sync/rules-changed handlers and the unmatch state. export default function LinkedTransactionsSection({ isNew, billId, billName, localHasRules, syncingPayments, onSync, onRulesChanged, linkedTransactions, linkedTransactionsLoading, transactionBusyId, onUnmatch, }) { return ( <> {/* Bank Matching Rules */} {!isNew && (
Bank matching rules
Transactions whose description contains these patterns are automatically imported as payments.
Linked transactions
{linkedTransactions.length} confirmed matches
{transactionTitle(transaction)}
{transaction.source_label || transaction.source_type_label || 'Transaction'}{transactionDate(transaction) ? fmtDate(transactionDate(transaction)) : 'No date'} · {transaction.description || transaction.memo || 'No description'}
{transaction.account_name && ({transaction.account_name}
)}{fmtTransactionAmount(transaction.amount, transaction.currency)}