@@ -107,23 +107,7 @@ function ImageLink({ type }: { type: RedirectExplorer }) {
107
107
}
108
108
109
109
function RedirectContent ( ) {
110
- const { suiscanUrl, suivisionUrl } = useRedirectExplorerUrl ( ) ;
111
110
const redirectExplorers = useRedirectExplorerOrder ( ) ;
112
- const {
113
- checked,
114
- preference,
115
- } = usePreference ( ) ;
116
-
117
- useEffect ( ( ) => {
118
- if ( checked && preference ) {
119
- const redirectUrl = preference === RedirectExplorer . SUISCAN ? suiscanUrl : suivisionUrl ;
120
- ampli . redirectToExternalExplorer ( {
121
- name : preference ,
122
- url : redirectUrl ,
123
- } ) ;
124
- window . location . href = redirectUrl ;
125
- }
126
- } , [ checked , preference , suiscanUrl , suivisionUrl ] ) ;
127
111
128
112
return (
129
113
< section className = "flex flex-col gap-10" >
@@ -208,6 +192,11 @@ export function PageLayout({ gradient, content, loading, isError }: PageLayoutPr
208
192
const [ network ] = useNetworkContext ( ) ;
209
193
const { request } = useAppsBackend ( ) ;
210
194
const outageOverride = useFeatureIsOn ( 'network-outage-override' ) ;
195
+ const { suiscanUrl, suivisionUrl } = useRedirectExplorerUrl ( ) ;
196
+ const {
197
+ checked,
198
+ preference,
199
+ } = usePreference ( ) ;
211
200
212
201
const { data } = useQuery ( {
213
202
queryKey : [ 'apps-backend' , 'monitor-network' ] ,
@@ -226,11 +215,33 @@ export function PageLayout({ gradient, content, loading, isError }: PageLayoutPr
226
215
const headerRef = useRef < HTMLElement | null > ( null ) ;
227
216
const [ headerHeight ] = useElementDimensions ( headerRef , DEFAULT_HEADER_HEIGHT ) ;
228
217
218
+ useEffect ( ( ) => {
219
+ if ( checked && preference ) {
220
+ const redirectUrl = preference === RedirectExplorer . SUISCAN ? suiscanUrl : suivisionUrl ;
221
+ ampli . redirectToExternalExplorer ( {
222
+ name : preference ,
223
+ url : redirectUrl ,
224
+ } ) ;
225
+ window . location . href = redirectUrl ;
226
+ }
227
+ } , [ checked , preference , suiscanUrl , suivisionUrl ] ) ;
228
+
229
+
229
230
const networkDegradeBannerCopy =
230
231
network === Network . TESTNET
231
232
? 'Sui Explorer (Testnet) is currently under-going maintenance. Some data may be incorrect or missing.'
232
233
: "The explorer is running slower than usual. We're working to fix the issue and appreciate your patience." ;
233
234
235
+ if ( checked && preference ) {
236
+ return (
237
+ < div className = "h-full w-full relative" >
238
+ < div className = "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2" >
239
+ < LoadingIndicator />
240
+ </ div >
241
+ </ div >
242
+ )
243
+ }
244
+
234
245
return (
235
246
< div className = "relative min-h-screen w-full" >
236
247
< section ref = { headerRef } className = "fixed top-0 z-20 flex w-full flex-col" >
0 commit comments