2020-03-13 18:23:46 +08:00
|
|
|
import React from "react";
|
2020-04-24 23:12:37 +08:00
|
|
|
import { Link, Switch, Route, Redirect } from "react-router-dom";
|
2020-03-19 20:43:53 +08:00
|
|
|
|
2020-03-31 21:58:48 +08:00
|
|
|
import AccountsCard from "./components/AccountsCard";
|
2020-05-12 18:32:14 +08:00
|
|
|
import AccountDetails from "./components/AccountDetails";
|
2020-03-17 12:04:04 +08:00
|
|
|
import TransactionsCard from "./components/TransactionsCard";
|
2020-04-29 20:48:38 +08:00
|
|
|
import TransactionDetails from "./components/TransactionDetails";
|
2020-03-31 14:36:40 +08:00
|
|
|
import ClusterModal from "./components/ClusterModal";
|
2020-03-29 11:54:51 -07:00
|
|
|
import Logo from "./img/logos-solana/light-explorer-logo.svg";
|
2020-04-29 20:48:38 +08:00
|
|
|
import { TX_ALIASES } from "./providers/transactions";
|
2020-05-12 18:32:14 +08:00
|
|
|
import { ACCOUNT_ALIASES, ACCOUNT_ALIASES_PLURAL } from "./providers/accounts";
|
2020-04-29 20:48:38 +08:00
|
|
|
import TabbedPage from "components/TabbedPage";
|
2020-05-23 15:17:07 +08:00
|
|
|
import TopAccountsCard from "components/TopAccountsCard";
|
2020-05-23 03:09:28 +08:00
|
|
|
import SupplyCard from "components/SupplyCard";
|
2020-08-01 22:05:58 +08:00
|
|
|
import StatsCard from "components/StatsCard";
|
2020-06-03 18:49:33 +08:00
|
|
|
import { pickCluster } from "utils/url";
|
2020-07-26 21:11:27 +08:00
|
|
|
import Banner from "components/Banner";
|
2020-03-13 17:07:58 +08:00
|
|
|
|
|
|
|
function App() {
|
|
|
|
return (
|
2020-04-24 20:11:30 +08:00
|
|
|
<>
|
2020-04-29 20:48:38 +08:00
|
|
|
<ClusterModal />
|
2020-04-24 20:11:30 +08:00
|
|
|
<div className="main-content">
|
|
|
|
<nav className="navbar navbar-expand-xl navbar-light">
|
|
|
|
<div className="container">
|
|
|
|
<div className="row align-items-end">
|
|
|
|
<div className="col">
|
2020-06-03 18:49:33 +08:00
|
|
|
<Link
|
2020-06-24 16:07:47 +08:00
|
|
|
to={(location) => ({
|
|
|
|
...pickCluster(location),
|
|
|
|
pathname: "/",
|
|
|
|
})}
|
2020-06-03 18:49:33 +08:00
|
|
|
>
|
2020-04-29 20:48:38 +08:00
|
|
|
<img src={Logo} width="250" alt="Solana Explorer" />
|
|
|
|
</Link>
|
2020-04-24 20:11:30 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</nav>
|
2020-04-06 01:34:04 +08:00
|
|
|
|
2020-07-26 21:11:27 +08:00
|
|
|
<Banner />
|
|
|
|
|
2020-04-29 20:48:38 +08:00
|
|
|
<Switch>
|
2020-05-23 03:09:28 +08:00
|
|
|
<Route exact path="/supply">
|
|
|
|
<TabbedPage tab="Supply">
|
|
|
|
<SupplyCard />
|
2020-05-23 15:17:07 +08:00
|
|
|
<TopAccountsCard />
|
|
|
|
</TabbedPage>
|
|
|
|
</Route>
|
2020-06-02 17:27:07 +08:00
|
|
|
<Route
|
|
|
|
exact
|
|
|
|
path="/accounts/top"
|
|
|
|
render={({ location }) => (
|
|
|
|
<Redirect to={{ ...location, pathname: "/supply" }} />
|
|
|
|
)}
|
|
|
|
></Route>
|
2020-04-29 20:48:38 +08:00
|
|
|
<Route
|
|
|
|
exact
|
2020-06-24 16:07:47 +08:00
|
|
|
path={TX_ALIASES.flatMap((tx) => [tx, tx + "s"]).map(
|
|
|
|
(tx) => `/${tx}/:signature`
|
2020-05-03 12:07:51 +08:00
|
|
|
)}
|
2020-04-29 20:48:38 +08:00
|
|
|
render={({ match }) => (
|
|
|
|
<TransactionDetails signature={match.params.signature} />
|
|
|
|
)}
|
|
|
|
/>
|
2020-06-24 16:07:47 +08:00
|
|
|
<Route exact path={TX_ALIASES.map((tx) => `/${tx}s`)}>
|
2020-04-29 20:48:38 +08:00
|
|
|
<TabbedPage tab="Transactions">
|
2020-04-24 23:12:37 +08:00
|
|
|
<TransactionsCard />
|
2020-04-29 20:48:38 +08:00
|
|
|
</TabbedPage>
|
|
|
|
</Route>
|
2020-05-12 18:32:14 +08:00
|
|
|
<Route
|
|
|
|
exact
|
|
|
|
path={ACCOUNT_ALIASES.concat(ACCOUNT_ALIASES_PLURAL).map(
|
2020-06-24 16:07:47 +08:00
|
|
|
(account) => `/${account}/:address`
|
2020-05-12 18:32:14 +08:00
|
|
|
)}
|
|
|
|
render={({ match }) => (
|
|
|
|
<AccountDetails address={match.params.address} />
|
|
|
|
)}
|
|
|
|
/>
|
2020-06-24 16:07:47 +08:00
|
|
|
<Route
|
|
|
|
exact
|
|
|
|
path={ACCOUNT_ALIASES_PLURAL.map((alias) => "/" + alias)}
|
|
|
|
>
|
2020-04-29 20:48:38 +08:00
|
|
|
<TabbedPage tab="Accounts">
|
2020-04-24 23:12:37 +08:00
|
|
|
<AccountsCard />
|
2020-04-29 20:48:38 +08:00
|
|
|
</TabbedPage>
|
|
|
|
</Route>
|
2020-08-01 22:05:58 +08:00
|
|
|
<Route>
|
|
|
|
<TabbedPage tab="Stats">
|
|
|
|
<StatsCard />
|
|
|
|
</TabbedPage>
|
|
|
|
</Route>
|
2020-04-29 20:48:38 +08:00
|
|
|
</Switch>
|
2020-04-24 20:11:30 +08:00
|
|
|
</div>
|
|
|
|
</>
|
2020-03-13 17:07:58 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default App;
|