2021-11-25 09:28:45 +00:00
|
|
|
import React, { Suspense } from "react";
|
|
|
|
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
|
2021-07-24 08:46:48 +00:00
|
|
|
import WarningHeader from "./WarningHeader";
|
2021-07-01 18:21:40 +00:00
|
|
|
import Home from "./Home";
|
2021-11-25 09:28:45 +00:00
|
|
|
import Main from "./Main";
|
2021-07-12 20:10:16 +00:00
|
|
|
import ConnectionErrorPanel from "./ConnectionErrorPanel";
|
2021-07-10 06:17:07 +00:00
|
|
|
import Footer from "./Footer";
|
2021-07-12 20:10:16 +00:00
|
|
|
import { ConnectionStatus } from "./types";
|
2021-07-09 05:07:20 +00:00
|
|
|
import { RuntimeContext, useRuntime } from "./useRuntime";
|
2021-07-01 18:21:40 +00:00
|
|
|
|
2021-10-24 04:21:20 +00:00
|
|
|
const Block = React.lazy(
|
|
|
|
() => import(/* webpackChunkName: "block", webpackPrefetch: true */ "./Block")
|
|
|
|
);
|
|
|
|
const BlockTransactions = React.lazy(
|
|
|
|
() =>
|
|
|
|
import(
|
|
|
|
/* webpackChunkName: "blocktxs", webpackPrefetch: true */ "./BlockTransactions"
|
|
|
|
)
|
|
|
|
);
|
2022-01-24 19:18:28 +00:00
|
|
|
const Address = React.lazy(
|
2021-10-24 04:21:20 +00:00
|
|
|
() =>
|
2022-01-24 19:18:28 +00:00
|
|
|
import(/* webpackChunkName: "address", webpackPrefetch: true */ "./Address")
|
2021-10-24 04:21:20 +00:00
|
|
|
);
|
|
|
|
const Transaction = React.lazy(
|
|
|
|
() =>
|
|
|
|
import(/* webpackChunkName: "tx", webpackPrefetch: true */ "./Transaction")
|
|
|
|
);
|
|
|
|
const London = React.lazy(
|
|
|
|
() =>
|
|
|
|
import(
|
|
|
|
/* webpackChunkName: "london", webpackPrefetch: true */ "./special/london/London"
|
|
|
|
)
|
|
|
|
);
|
2022-01-31 18:53:25 +00:00
|
|
|
const PageNotFound = React.lazy(
|
|
|
|
() =>
|
|
|
|
import(
|
|
|
|
/* webpackChunkName: "notfound", webpackPrefetch: true */ "./PageNotFound"
|
|
|
|
)
|
|
|
|
);
|
2021-07-01 18:21:40 +00:00
|
|
|
|
2021-07-08 19:02:42 +00:00
|
|
|
const App = () => {
|
2021-07-09 05:07:20 +00:00
|
|
|
const runtime = useRuntime();
|
2021-07-08 19:02:42 +00:00
|
|
|
|
|
|
|
return (
|
2021-10-24 04:12:05 +00:00
|
|
|
<Suspense fallback={null}>
|
2021-07-12 20:10:16 +00:00
|
|
|
{runtime.connStatus !== ConnectionStatus.CONNECTED ? (
|
|
|
|
<ConnectionErrorPanel
|
|
|
|
connStatus={runtime.connStatus}
|
|
|
|
config={runtime.config}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<RuntimeContext.Provider value={runtime}>
|
|
|
|
<div className="h-screen flex flex-col">
|
2021-07-24 08:46:48 +00:00
|
|
|
<WarningHeader />
|
2021-07-12 20:10:16 +00:00
|
|
|
<Router>
|
2021-11-25 09:28:45 +00:00
|
|
|
<Routes>
|
|
|
|
<Route index element={<Home />} />
|
|
|
|
<Route path="/special/london" element={<London />} />
|
|
|
|
<Route path="*" element={<Main />}>
|
|
|
|
<Route path="block/:blockNumberOrHash" element={<Block />} />
|
|
|
|
<Route
|
|
|
|
path="block/:blockNumber/txs"
|
|
|
|
element={<BlockTransactions />}
|
|
|
|
/>
|
|
|
|
<Route path="tx/:txhash/*" element={<Transaction />} />
|
|
|
|
<Route
|
2021-11-26 06:38:24 +00:00
|
|
|
path="address/:addressOrName/*"
|
2022-01-24 19:18:28 +00:00
|
|
|
element={<Address />}
|
2021-11-25 09:28:45 +00:00
|
|
|
/>
|
2022-01-31 18:53:25 +00:00
|
|
|
<Route path="*" element={<PageNotFound />} />
|
2021-07-12 20:10:16 +00:00
|
|
|
</Route>
|
2021-11-25 09:28:45 +00:00
|
|
|
</Routes>
|
2021-07-12 20:10:16 +00:00
|
|
|
</Router>
|
|
|
|
<Footer />
|
|
|
|
</div>
|
|
|
|
</RuntimeContext.Provider>
|
|
|
|
)}
|
2021-07-08 19:02:42 +00:00
|
|
|
</Suspense>
|
|
|
|
);
|
|
|
|
};
|
2021-07-01 18:21:40 +00:00
|
|
|
|
2021-11-25 09:28:45 +00:00
|
|
|
export default App;
|