Extract footer
This commit is contained in:
parent
f79817fc5d
commit
70c29b562f
|
@ -3,6 +3,7 @@ import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
|
||||||
import Home from "./Home";
|
import Home from "./Home";
|
||||||
import Search from "./Search";
|
import Search from "./Search";
|
||||||
import Title from "./Title";
|
import Title from "./Title";
|
||||||
|
import Footer from "./Footer";
|
||||||
import { RuntimeContext, useRuntime } from "./useRuntime";
|
import { RuntimeContext, useRuntime } from "./useRuntime";
|
||||||
|
|
||||||
const Block = React.lazy(() => import("./Block"));
|
const Block = React.lazy(() => import("./Block"));
|
||||||
|
@ -16,6 +17,7 @@ const App = () => {
|
||||||
return (
|
return (
|
||||||
<Suspense fallback={<>LOADING</>}>
|
<Suspense fallback={<>LOADING</>}>
|
||||||
<RuntimeContext.Provider value={runtime}>
|
<RuntimeContext.Provider value={runtime}>
|
||||||
|
<div className="h-screen flex flex-col">
|
||||||
<Router>
|
<Router>
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path="/" exact>
|
<Route path="/" exact>
|
||||||
|
@ -25,6 +27,7 @@ const App = () => {
|
||||||
<Search />
|
<Search />
|
||||||
</Route>
|
</Route>
|
||||||
<Route>
|
<Route>
|
||||||
|
<div className="mb-auto">
|
||||||
<Title />
|
<Title />
|
||||||
<Route path="/block/:blockNumberOrHash" exact>
|
<Route path="/block/:blockNumberOrHash" exact>
|
||||||
<Block />
|
<Block />
|
||||||
|
@ -38,9 +41,12 @@ const App = () => {
|
||||||
<Route path="/address/:addressOrName/:direction?">
|
<Route path="/address/:addressOrName/:direction?">
|
||||||
<AddressTransactions />
|
<AddressTransactions />
|
||||||
</Route>
|
</Route>
|
||||||
|
</div>
|
||||||
</Route>
|
</Route>
|
||||||
</Switch>
|
</Switch>
|
||||||
</Router>
|
</Router>
|
||||||
|
<Footer />
|
||||||
|
</div>
|
||||||
</RuntimeContext.Provider>
|
</RuntimeContext.Provider>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
);
|
);
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
import React, { useContext } from "react";
|
||||||
|
import { RuntimeContext } from "./useRuntime";
|
||||||
|
|
||||||
|
const Footer: React.FC = () => {
|
||||||
|
const { provider } = useContext(RuntimeContext);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="w-full px-2 py-1 border-t border-t-gray-100 text-xs bg-link-blue text-gray-200 text-center">
|
||||||
|
{provider ? (
|
||||||
|
<>Using Erigon node at {provider.connection.url}</>
|
||||||
|
) : (
|
||||||
|
<>Waiting for the provider...</>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default React.memo(Footer);
|
17
src/Home.tsx
17
src/Home.tsx
|
@ -31,11 +31,10 @@ const Home: React.FC = () => {
|
||||||
document.title = "Home | Otterscan";
|
document.title = "Home | Otterscan";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="h-screen flex m-auto">
|
<div className="m-auto">
|
||||||
<div className="flex flex-col m-auto">
|
|
||||||
<Logo />
|
<Logo />
|
||||||
<form
|
<form
|
||||||
className="flex flex-col m-auto"
|
className="flex flex-col"
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
spellCheck={false}
|
spellCheck={false}
|
||||||
|
@ -59,22 +58,12 @@ const Home: React.FC = () => {
|
||||||
className="mx-auto flex flex-col items-center space-y-1 mt-5 text-sm text-gray-500 hover:text-link-blue"
|
className="mx-auto flex flex-col items-center space-y-1 mt-5 text-sm text-gray-500 hover:text-link-blue"
|
||||||
to={`/block/${latestBlock.number}`}
|
to={`/block/${latestBlock.number}`}
|
||||||
>
|
>
|
||||||
<div>
|
<div>Latest block: {ethers.utils.commify(latestBlock.number)}</div>
|
||||||
Latest block: {ethers.utils.commify(latestBlock.number)}
|
|
||||||
</div>
|
|
||||||
<Timestamp value={latestBlock.timestamp} />
|
<Timestamp value={latestBlock.timestamp} />
|
||||||
</NavLink>
|
</NavLink>
|
||||||
)}
|
)}
|
||||||
<span className="mx-auto mt-5 text-xs text-gray-500">
|
|
||||||
{provider ? (
|
|
||||||
<>Using Erigon node at {provider.connection.url}</>
|
|
||||||
) : (
|
|
||||||
<>Waiting for the provider...</>
|
|
||||||
)}
|
|
||||||
</span>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
const Logo: React.FC = () => (
|
const Logo: React.FC = () => (
|
||||||
<div className="mx-auto -mt-32 mb-16 text-6xl text-link-blue font-title font-bold cursor-default flex items-center space-x-4">
|
<div className="mx-auto mb-16 text-6xl text-link-blue font-title font-bold cursor-default flex items-center space-x-4">
|
||||||
<img
|
<img
|
||||||
className="rounded-full"
|
className="rounded-full"
|
||||||
src="/otter.jpg"
|
src="/otter.jpg"
|
||||||
|
|
Loading…
Reference in New Issue