({ transactions }: TransactionTableProps)
| 27 | } |
| 28 | |
| 29 | const TransactionsTable = ({ transactions }: TransactionTableProps) => { |
| 30 | return ( |
| 31 | <Table> |
| 32 | <TableHeader className="bg-[#f9fafb]"> |
| 33 | <TableRow> |
| 34 | <TableHead className="px-2">Transaction</TableHead> |
| 35 | <TableHead className="px-2">Amount</TableHead> |
| 36 | <TableHead className="px-2">Status</TableHead> |
| 37 | <TableHead className="px-2">Date</TableHead> |
| 38 | <TableHead className="px-2 max-md:hidden">Channel</TableHead> |
| 39 | <TableHead className="px-2 max-md:hidden">Category</TableHead> |
| 40 | </TableRow> |
| 41 | </TableHeader> |
| 42 | <TableBody> |
| 43 | {transactions.map((t: Transaction) => { |
| 44 | const status = getTransactionStatus(new Date(t.date)) |
| 45 | const amount = formatAmount(t.amount) |
| 46 | |
| 47 | const isDebit = t.type === 'debit'; |
| 48 | const isCredit = t.type === 'credit'; |
| 49 | |
| 50 | return ( |
| 51 | <TableRow key={t.id} className={`${isDebit || amount[0] === '-' ? 'bg-[#FFFBFA]' : 'bg-[#F6FEF9]'} !over:bg-none !border-b-DEFAULT`}> |
| 52 | <TableCell className="max-w-[250px] pl-2 pr-10"> |
| 53 | <div className="flex items-center gap-3"> |
| 54 | <h1 className="text-14 truncate font-semibold text-[#344054]"> |
| 55 | {removeSpecialCharacters(t.name)} |
| 56 | </h1> |
| 57 | </div> |
| 58 | </TableCell> |
| 59 | |
| 60 | <TableCell className={`pl-2 pr-10 font-semibold ${ |
| 61 | isDebit || amount[0] === '-' ? |
| 62 | 'text-[#f04438]' |
| 63 | : 'text-[#039855]' |
| 64 | }`}> |
| 65 | {isDebit ? `-${amount}` : isCredit ? amount : amount} |
| 66 | </TableCell> |
| 67 | |
| 68 | <TableCell className="pl-2 pr-10"> |
| 69 | <CategoryBadge category={status} /> |
| 70 | </TableCell> |
| 71 | |
| 72 | <TableCell className="min-w-32 pl-2 pr-10"> |
| 73 | {formatDateTime(new Date(t.date)).dateTime} |
| 74 | </TableCell> |
| 75 | |
| 76 | <TableCell className="pl-2 pr-10 capitalize min-w-24"> |
| 77 | {t.paymentChannel} |
| 78 | </TableCell> |
| 79 | |
| 80 | <TableCell className="pl-2 pr-10 max-md:hidden"> |
| 81 | <CategoryBadge category={t.category} /> |
| 82 | </TableCell> |
| 83 | </TableRow> |
| 84 | ) |
| 85 | })} |
| 86 | </TableBody> |
nothing calls this directly
no test coverage detected