@@ -4,12 +4,14 @@ import { InfoBadge } from "~/components/info-badge";
4
4
import { type TxEffectTableSchema } from "~/components/tx-effects/tx-effects-schema" ;
5
5
import { TxEffectsTable } from "~/components/tx-effects/tx-effects-table" ;
6
6
import {
7
+ SystemHealthStatus ,
7
8
useAvarageBlockTime ,
8
9
useAvarageFees ,
9
10
useGetTxEffectsByBlockHeightRange ,
10
11
useLatestBlocks ,
11
12
usePendingTxs ,
12
13
useSubTitle ,
14
+ useSystemHealth ,
13
15
useTotalContracts ,
14
16
useTotalContractsLast24h ,
15
17
useTotalTxEffects ,
@@ -20,6 +22,7 @@ import { routes } from "~/routes/__root";
20
22
import { mapLatestBlocks , parseTxEffectsData } from "./util" ;
21
23
22
24
export const Landing : FC = ( ) => {
25
+ const { systemHealth } = useSystemHealth ( ) ;
23
26
const { data : latestBlocks , isLoading, error } = useLatestBlocks ( ) ;
24
27
const {
25
28
data : totalTxEffects ,
@@ -92,67 +95,79 @@ export const Landing: FC = () => {
92
95
93
96
return (
94
97
< div className = "mx-auto px-5 max-w-[1440px] md:px-[70px]" >
95
- < div className = "hidden md:mt-16 md:flex flex-wrap justify-center my-20" >
96
- < h1 className = "" > Explore the power of privacy on Aztec</ h1 >
97
- </ div >
98
- < div className = "grid grid-cols-2 gap-3 my-20 md:grid-cols-3 md:gap-5" >
99
- < InfoBadge
100
- title = "Total transactions"
101
- isLoading = { loadingTotalEffects }
102
- error = { errorTotalEffects }
103
- data = { totalTxEffects }
104
- />
105
- < InfoBadge
106
- title = "Total Contract Classes"
107
- isLoading = { loadingAmountContracts }
108
- error = { errorAmountContracts }
109
- data = { totalAmountOfContracts }
110
- />
111
- < InfoBadge
112
- title = { `Average fees (${ formattedFees . denomination } FPA)` }
113
- isLoading = { loadingAvarageFees }
114
- error = { errorAvarageFees }
115
- data = { formattedFees . value }
116
- />
117
- < InfoBadge
118
- title = "Total transactions last 24h"
119
- isLoading = { loadingTotalEffects24h }
120
- error = { errorTotalEffects24h }
121
- data = { totalTxEffects24h }
122
- />
123
- < InfoBadge
124
- title = "Total Contract Classes last 24h"
125
- isLoading = { loadingAmountContracts24h }
126
- error = { errorAmountContracts24h }
127
- data = { totalAmountOfContracts24h }
128
- />
129
- < InfoBadge
130
- title = "Average block time"
131
- isLoading = { loadingAvarageBlockTime }
132
- error = { errorAvarageBlockTime }
133
- data = { averageBlockTimeFormatted }
134
- />
135
- </ div >
136
- < div className = "flex flex-col gap-4 md:flex-row" >
137
- < div className = "bg-white rounded-lg shadow-lg w-full md:w-1/2" >
138
- < BlocksTable
139
- title = "Latest Blocks"
140
- blocks = { mapLatestBlocks ( latestBlocks ) }
141
- isLoading = { isLoading }
142
- error = { error }
143
- disableSizeSelector = { true }
144
- />
98
+ { systemHealth . health === SystemHealthStatus . DOWN && (
99
+ < div className = "flex flex-col bg-white w-full h-96 justify-between rounded-lg shadow-md mt-20" >
100
+ < div className = "flex flex-col items-center justify-center h-full" >
101
+ < h3 > System is down</ h3 >
102
+ < p > { systemHealth . reason ?? "No reason provided" } </ p >
103
+ </ div >
145
104
</ div >
146
- < div className = "bg-white rounded-lg shadow-lg w-full md:w-1/2" >
147
- < TxEffectsTable
148
- title = "Latest TX-Effects"
149
- txEffects = { latestTxEffectsWithPending }
150
- isLoading = { isLoadingTxEffects }
151
- error = { txEffectsError }
152
- disableSizeSelector = { true }
153
- />
154
- </ div >
155
- </ div >
105
+ ) }
106
+ { systemHealth . health !== SystemHealthStatus . DOWN && (
107
+ < >
108
+ < div className = "hidden md:mt-16 md:flex flex-wrap justify-center my-20" >
109
+ < h1 className = "" > Explore the power of privacy on Aztec</ h1 >
110
+ </ div >
111
+ < div className = "grid grid-cols-2 gap-3 my-20 md:grid-cols-3 md:gap-5" >
112
+ < InfoBadge
113
+ title = "Total transactions"
114
+ isLoading = { loadingTotalEffects }
115
+ error = { errorTotalEffects }
116
+ data = { totalTxEffects }
117
+ />
118
+ < InfoBadge
119
+ title = "Total Contract Classes"
120
+ isLoading = { loadingAmountContracts }
121
+ error = { errorAmountContracts }
122
+ data = { totalAmountOfContracts }
123
+ />
124
+ < InfoBadge
125
+ title = { `Average fees (${ formattedFees . denomination } FPA)` }
126
+ isLoading = { loadingAvarageFees }
127
+ error = { errorAvarageFees }
128
+ data = { formattedFees . value }
129
+ />
130
+ < InfoBadge
131
+ title = "Total transactions last 24h"
132
+ isLoading = { loadingTotalEffects24h }
133
+ error = { errorTotalEffects24h }
134
+ data = { totalTxEffects24h }
135
+ />
136
+ < InfoBadge
137
+ title = "Total Contract Classes last 24h"
138
+ isLoading = { loadingAmountContracts24h }
139
+ error = { errorAmountContracts24h }
140
+ data = { totalAmountOfContracts24h }
141
+ />
142
+ < InfoBadge
143
+ title = "Average block time"
144
+ isLoading = { loadingAvarageBlockTime }
145
+ error = { errorAvarageBlockTime }
146
+ data = { averageBlockTimeFormatted }
147
+ />
148
+ </ div >
149
+ < div className = "flex flex-col gap-4 md:flex-row" >
150
+ < div className = "bg-white rounded-lg shadow-lg w-full md:w-1/2" >
151
+ < BlocksTable
152
+ title = "Latest Blocks"
153
+ blocks = { mapLatestBlocks ( latestBlocks ) }
154
+ isLoading = { isLoading }
155
+ error = { error }
156
+ disableSizeSelector = { true }
157
+ />
158
+ </ div >
159
+ < div className = "bg-white rounded-lg shadow-lg w-full md:w-1/2" >
160
+ < TxEffectsTable
161
+ title = "Latest TX-Effects"
162
+ txEffects = { latestTxEffectsWithPending }
163
+ isLoading = { isLoadingTxEffects }
164
+ error = { txEffectsError }
165
+ disableSizeSelector = { true }
166
+ />
167
+ </ div >
168
+ </ div >
169
+ </ >
170
+ ) }
156
171
</ div >
157
172
) ;
158
173
} ;
0 commit comments