forked from MergeFi/frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
12 lines (12 loc) · 823 Bytes
/
Copy pathindex.tsx
File metadata and controls
12 lines (12 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
import React from 'react'
import { useTransactionHistory } from '../../hooks/useTransactionHistory'
import { TransactionItem } from './TransactionItem'
interface Props { address: string | null }
export function TransactionHistory({ address }: Props) {
const { transactions, loading, error } = useTransactionHistory(address)
if (!address) return <p className='text-center py-8 text-gray-400'>Connect wallet to view history</p>
if (loading) return <p className='text-center py-8'>Loading…</p>
if (error) return <p className='text-red-500 text-center py-8'>Error: {error}</p>
if (!transactions.length) return <p className='text-center py-8 text-gray-400'>No transactions yet</p>
return <div>{transactions.map((tx, i) => <TransactionItem key={i} tx={tx as Record<string,unknown>} myAddress={address} />)}</div>
}