2021-07-01 18:21:40 +00:00
|
|
|
import React, { Suspense } from "react";
|
|
|
|
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
|
|
|
|
import Home from "./Home";
|
|
|
|
import Search from "./Search";
|
|
|
|
import Title from "./Title";
|
2021-07-08 19:02:42 +00:00
|
|
|
import { useProvider, ProviderContext } from "./useProvider";
|
2021-07-01 18:21:40 +00:00
|
|
|
|
|
|
|
const Block = React.lazy(() => import("./Block"));
|
|
|
|
const BlockTransactions = React.lazy(() => import("./BlockTransactions"));
|
|
|
|
const AddressTransactions = React.lazy(() => import("./AddressTransactions"));
|
|
|
|
const Transaction = React.lazy(() => import("./Transaction"));
|
|
|
|
|
2021-07-08 19:02:42 +00:00
|
|
|
const App = () => {
|
|
|
|
const provider = useProvider();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Suspense fallback={<>LOADING</>}>
|
|
|
|
<ProviderContext.Provider value={provider}>
|
|
|
|
<Router>
|
|
|
|
<Switch>
|
|
|
|
<Route path="/" exact>
|
|
|
|
<Home />
|
|
|
|
</Route>
|
|
|
|
<Route path="/search" exact>
|
|
|
|
<Search />
|
|
|
|
</Route>
|
|
|
|
<Route>
|
|
|
|
<Title />
|
|
|
|
<Route path="/block/:blockNumberOrHash" exact>
|
|
|
|
<Block />
|
|
|
|
</Route>
|
|
|
|
<Route path="/block/:blockNumber/txs" exact>
|
|
|
|
<BlockTransactions />
|
|
|
|
</Route>
|
|
|
|
<Route path="/tx/:txhash">
|
|
|
|
<Transaction />
|
|
|
|
</Route>
|
|
|
|
<Route path="/address/:addressOrName/:direction?">
|
|
|
|
<AddressTransactions />
|
|
|
|
</Route>
|
|
|
|
</Route>
|
|
|
|
</Switch>
|
|
|
|
</Router>
|
|
|
|
</ProviderContext.Provider>
|
|
|
|
</Suspense>
|
|
|
|
);
|
|
|
|
};
|
2021-07-01 18:21:40 +00:00
|
|
|
|
|
|
|
export default React.memo(App);
|