11import { Link } from 'react-router-dom'
22import { Receipt } from 'lucide-react'
33import { useTranslations } from '@/lib/i18n'
4- import { useLatestTransactions , type RecentBlock } from '@/hooks/use-recent-blocks '
4+ import { useRecentTransactions } from '@/hooks/use-recent-transactions '
55import { Skeleton } from '@/components/ui/skeleton'
66import { CopyButton } from '@/components/copy-button'
77import { RelativeTime } from '@/components/detail/relative-time'
88import { shortHash } from '@/lib/format'
99
1010interface LatestTxListProps {
11- blocks : RecentBlock [ ] | undefined
12- isLoading : boolean
13- isError : boolean
1411 max ?: number
1512}
1613
17- export function LatestTxList ( { blocks , isLoading , isError , max = 20 } : LatestTxListProps ) {
14+ export function LatestTxList ( { max = 20 } : LatestTxListProps ) {
1815 const t = useTranslations ( 'home' )
19- const transactions = useLatestTransactions ( blocks , max )
16+ // Use the recent-transactions feed (includes the total output amount) rather
17+ // than deriving bare txids from recent blocks, so each row can show a value.
18+ const { data, isLoading, isError } = useRecentTransactions ( max )
19+ const transactions = data ?. transactions ?? [ ]
2020
2121 return (
2222 < div className = "flex h-full flex-col rounded-2xl border bg-muted/30" >
@@ -43,7 +43,7 @@ export function LatestTxList({ blocks, isLoading, isError, max = 20 }: LatestTxL
4343 < ul className = "divide-y" >
4444 { transactions . map ( ( tx ) => (
4545 < li
46- key = { tx . txid }
46+ key = { ` ${ tx . txid } - ${ tx . blockHeight ?? 'mempool' } ` }
4747 className = "group flex items-center gap-3 px-4 py-2.5 transition-colors hover:bg-muted/40"
4848 >
4949 < div className = "flex min-w-0 flex-1 items-center gap-2" >
@@ -60,16 +60,24 @@ export function LatestTxList({ blocks, isLoading, isError, max = 20 }: LatestTxL
6060 </ div >
6161
6262 < div className = "flex shrink-0 flex-col items-end gap-0.5 text-xs" >
63- < Link
64- to = { `/block/${ tx . blockHeight } ` }
65- className = "font-medium text-muted-foreground tabular-nums hover:text-foreground"
66- >
67- #{ tx . blockHeight . toLocaleString ( ) }
68- </ Link >
69- < RelativeTime
70- timestamp = { tx . blockTime }
71- className = "text-muted-foreground"
72- />
63+ { typeof tx . amount === 'number' ? (
64+ < span className = "font-semibold tabular-nums text-foreground" >
65+ { tx . amount . toLocaleString ( undefined , { maximumFractionDigits : 8 } ) } FAIR
66+ </ span >
67+ ) : null }
68+ { tx . blockHeight !== null ? (
69+ < Link
70+ to = { `/block/${ tx . blockHeight } ` }
71+ className = "font-medium text-muted-foreground tabular-nums hover:text-foreground"
72+ >
73+ #{ tx . blockHeight . toLocaleString ( ) }
74+ </ Link >
75+ ) : (
76+ < span className = "font-medium text-amber-700 dark:text-amber-300" >
77+ { t ( 'mempool' ) }
78+ </ span >
79+ ) }
80+ < RelativeTime timestamp = { tx . time } className = "text-muted-foreground" />
7381 </ div >
7482 </ li >
7583 ) ) }
0 commit comments