1
- import { useMemo , type FC } from "react" ;
1
+ import { type FC } from "react" ;
2
2
import { BlocksTable } from "~/components/blocks/blocks-table" ;
3
3
import { InfoBadge } from "~/components/info-badge" ;
4
- import { type TxEffectTableSchema } from "~/components/tx-effects/tx-effects-schema" ;
5
- import { TxEffectsTable } from "~/components/tx-effects/tx-effects-table" ;
6
4
import {
7
5
HealthStatus ,
8
6
useAvarageBlockTime ,
9
7
useAvarageFees ,
10
- useGetLatestTxEffects ,
11
8
useLatestBlocks ,
12
- usePendingTxs ,
13
9
useSubTitle ,
14
10
useSystemHealth ,
15
11
useTotalContracts ,
16
12
useTotalContractsLast24h ,
17
13
useTotalTxEffects ,
18
14
useTotalTxEffectsLast24h ,
19
15
} from "~/hooks" ;
20
- import { mapLatestBlocks , mapLatestTxEffects } from "~/lib/map-for-table" ;
16
+ import { mapLatestBlocks } from "~/lib/map-for-table" ;
21
17
import { formatDuration , formatFees } from "~/lib/utils" ;
22
18
import { routes } from "~/routes/__root" ;
19
+ import { TxEffectTableLanding } from "./tx-effect-table-landing" ;
23
20
24
21
export const Landing : FC = ( ) => {
25
22
const { systemHealth } = useSystemHealth ( ) ;
@@ -57,38 +54,6 @@ export const Landing: FC = () => {
57
54
58
55
useSubTitle ( latestBlocks ?. [ 0 ] ?. height . toString ( ) ?? routes . home . title ) ;
59
56
60
- const {
61
- data : latestTxEffectsData ,
62
- isLoading : isLoadingTxEffects ,
63
- error : txEffectsError ,
64
- } = useGetLatestTxEffects ( ) ;
65
-
66
- const { data : pendingTxs } = usePendingTxs ( ) ;
67
-
68
- const latestTxEffectsWithPending = useMemo ( ( ) => {
69
- if ( ! latestTxEffectsData ) {
70
- return [ ] ;
71
- }
72
- if ( ! latestBlocks ) {
73
- return [ ] ;
74
- }
75
- const disguisedPendingTxs =
76
- pendingTxs ?. reduce ( ( acc , tx ) => {
77
- if ( ! latestTxEffectsData . some ( ( effect ) => effect . txHash === tx . hash ) ) {
78
- acc . push ( {
79
- txHash : tx . hash ,
80
- transactionFee : - 1 ,
81
- blockNumber : - 1 ,
82
- timestamp : tx . birthTimestamp ?? 0 ,
83
- } ) ;
84
- }
85
- return acc ;
86
- } , [ ] as TxEffectTableSchema [ ] ) ?? [ ] ;
87
- return [
88
- ...disguisedPendingTxs ,
89
- ...mapLatestTxEffects ( latestTxEffectsData , latestBlocks ) ,
90
- ] ;
91
- } , [ pendingTxs , latestTxEffectsData , latestBlocks ] ) ;
92
57
93
58
const averageBlockTimeFormatted = formatDuration (
94
59
Number ( avarageBlockTime ) / 1000 ,
@@ -104,8 +69,8 @@ export const Landing: FC = () => {
104
69
loadingAvarageFees ||
105
70
loadingAmountContracts ||
106
71
loadingAmountContracts24h ||
107
- loadingAvarageBlockTime ||
108
- isLoadingTxEffects ;
72
+ loadingAvarageBlockTime ;
73
+
109
74
const isThereAnyComponentData =
110
75
( latestBlocks ?. length ?? 0 ) > 0 ||
111
76
! ! totalTxEffects ||
@@ -183,13 +148,7 @@ export const Landing: FC = () => {
183
148
/>
184
149
</ div >
185
150
< div className = "bg-white rounded-lg shadow-lg w-full md:w-1/2" >
186
- < TxEffectsTable
187
- title = "Latest TX-Effects"
188
- txEffects = { latestTxEffectsWithPending }
189
- isLoading = { isLoadingTxEffects }
190
- error = { txEffectsError }
191
- disableSizeSelector = { true }
192
- />
151
+ < TxEffectTableLanding latestBlocks = { latestBlocks } />
193
152
</ div >
194
153
</ div >
195
154
</ >
0 commit comments