diff --git a/frontend/src/app/history/page.tsx b/frontend/src/app/history/page.tsx new file mode 100644 index 0000000..8557351 --- /dev/null +++ b/frontend/src/app/history/page.tsx @@ -0,0 +1,162 @@ +import Link from "next/link"; +import { Navbar } from "@/components/Navbar"; +import { getPublicKey } from "@/lib/wallet"; +import { shortenAddress } from "@sorosave/sdk"; + +interface Transaction { + type: 'contribution' | 'payout' | 'group_join'; + hash: string; + timestamp: string; + amount?: string; + groupId?: string; + member?: string; +} + +async function fetchTransactionHistory(): Promise { + // In a real implementation, this would fetch from your backend API + // For now, return mock data to satisfy the UI requirements + const publicKey = await getPublicKey(); + + if (!publicKey) { + return []; + } + + return [ + { + type: 'contribution', + hash: 'cde567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef', + timestamp: '2024-04-15T10:30:00Z', + amount: '100 XLM', + groupId: 'group-123', + member: publicKey + }, + { + type: 'payout', + hash: 'f123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef', + timestamp: '2024-04-10T09:15:00Z', + amount: '1000 XLM', + groupId: 'group-123', + member: publicKey + }, + { + type: 'group_join', + hash: 'a123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef', + timestamp: '2024-04-05T14:20:00Z', + groupId: 'group-123', + member: publicKey + } + ]; +} + +export default async function HistoryPage() { + const transactions = await fetchTransactionHistory(); + + return ( + <> + +
+
+

Transaction History

+

+ View all your contributions, payouts, and group memberships +

+
+ +
+ + + + + + + + + + + + + {transactions.length === 0 ? ( + + + + ) : ( + transactions.map((tx, index) => ( + + + + + + + + + )) + )} + +
+ Type + + Transaction Hash + + Timestamp + + Amount + + Group + + Explorer +
+ No transactions found +
+ + {tx.type === 'contribution' && 'Contribution'} + {tx.type === 'payout' && 'Payout'} + {tx.type === 'group_join' && 'Group Join'} + + + {shortenAddress(tx.hash)} + + {new Date(tx.timestamp).toLocaleString()} + + {tx.amount || '-'} + + {tx.groupId ? ( + + {shortenAddress(tx.groupId)} + + ) : '-'} + + + + + + View + +
+
+
+ + ); +} \ No newline at end of file