-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTransactionTable.tsx
More file actions
63 lines (59 loc) · 2.68 KB
/
TransactionTable.tsx
File metadata and controls
63 lines (59 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import React from 'react';
import type { Transaction } from '../types';
import { TransactionStatus } from '../types';
interface TransactionTableProps {
transactions: Transaction[];
title: string;
}
const statusStyles: { [key in TransactionStatus]: string } = {
[TransactionStatus.Completed]: 'bg-green-500/10 text-green-400',
[TransactionStatus.Pending]: 'bg-yellow-500/10 text-yellow-400',
[TransactionStatus.Failed]: 'bg-red-500/10 text-red-400',
[TransactionStatus.Flagged]: 'bg-purple-500/10 text-purple-400',
};
export const TransactionTable: React.FC<TransactionTableProps> = ({ transactions, title }) => {
return (
<div className="bg-surface rounded-lg p-6 shadow-lg mt-8">
<h3 className="text-xl font-bold mb-4">{title}</h3>
<div className="overflow-x-auto">
<table className="w-full text-left">
<thead>
<tr className="border-b border-border text-sm text-text-secondary">
<th className="py-3 px-4 font-semibold">Transaction ID</th>
<th className="py-3 px-4 font-semibold">Date</th>
<th className="py-3 px-4 font-semibold">Amount</th>
<th className="py-3 px-4 font-semibold">Coin</th>
<th className="py-3 px-4 font-semibold">Network</th>
<th className="py-3 px-4 font-semibold">Status</th>
<th className="py-3 px-4 font-semibold">Sanctions</th>
</tr>
</thead>
<tbody>
{transactions.map(tx => (
<tr key={tx.id} className="border-b border-border hover:bg-gray-700/50">
<td className="py-3 px-4 text-sm font-mono">{tx.id}</td>
<td className="py-3 px-4 text-sm">{new Date(tx.timestamp).toLocaleString()}</td>
<td className="py-3 px-4 font-semibold">${tx.amount.toFixed(2)}</td>
<td className="py-3 px-4 text-sm">{tx.stablecoin}</td>
<td className="py-3 px-4 text-sm">{tx.network}</td>
<td className="py-3 px-4">
<span className={`px-2 py-1 rounded-full text-xs font-medium ${statusStyles[tx.status]}`}>
{tx.status}
</span>
</td>
<td className="py-3 px-4">
<span className={`px-2 py-1 rounded-full text-xs font-medium ${
tx.sanctionsCheck === 'Passed' ? 'text-green-400' :
tx.sanctionsCheck === 'Failed' ? 'text-red-400' : 'text-yellow-400'
}`}>
{tx.sanctionsCheck}
</span>
</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
);
};