2020-03-13 03:23:46 -07:00
|
|
|
import React from "react";
|
2020-04-24 08:12:37 -07:00
|
|
|
import { Link, Switch, Route, Redirect } from "react-router-dom";
|
2020-03-19 05:43:53 -07:00
|
|
|
|
2020-03-31 06:58:48 -07:00
|
|
|
import AccountsCard from "./components/AccountsCard";
|
2020-05-12 03:32:14 -07:00
|
|
|
import AccountDetails from "./components/AccountDetails";
|
2020-03-16 21:04:04 -07:00
|
|
|
import TransactionsCard from "./components/TransactionsCard";
|
2020-04-29 05:48:38 -07:00
|
|
|
import TransactionDetails from "./components/TransactionDetails";
|
2020-03-30 23:36:40 -07: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 05:48:38 -07:00
|
|
|
import { TX_ALIASES } from "./providers/transactions";
|
2020-05-12 03:32:14 -07:00
|
|
|
import { ACCOUNT_ALIASES, ACCOUNT_ALIASES_PLURAL } from "./providers/accounts";
|
2020-04-29 05:48:38 -07:00
|
|
|
import TabbedPage from "components/TabbedPage";
|
2020-05-22 12:09:28 -07:00
|
|
|
import SupplyCard from "components/SupplyCard";
|
2020-03-13 02:07:58 -07:00
|
|
|
|
|
|
|
function App() {
|
|
|
|
return (
|
2020-04-24 05:11:30 -07:00
|
|
|
<>
|
2020-04-29 05:48:38 -07:00
|
|
|
<ClusterModal />
|
2020-04-24 05:11:30 -07: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-05-01 21:55:12 -07:00
|
|
|
<Link to={location => ({ ...location, pathname: "/" })}>
|
2020-04-29 05:48:38 -07:00
|
|
|
<img src={Logo} width="250" alt="Solana Explorer" />
|
|
|
|
</Link>
|
2020-04-24 05:11:30 -07:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</nav>
|
2020-04-05 10:34:04 -07:00
|
|
|
|
2020-04-29 05:48:38 -07:00
|
|
|
<Switch>
|
2020-05-22 12:09:28 -07:00
|
|
|
<Route exact path="/supply">
|
|
|
|
<TabbedPage tab="Supply">
|
|
|
|
<SupplyCard />
|
|
|
|
</TabbedPage>
|
|
|
|
</Route>
|
2020-04-29 05:48:38 -07:00
|
|
|
<Route
|
|
|
|
exact
|
2020-05-02 21:07:51 -07:00
|
|
|
path={TX_ALIASES.flatMap(tx => [tx, tx + "s"]).map(
|
|
|
|
tx => `/${tx}/:signature`
|
|
|
|
)}
|
2020-04-29 05:48:38 -07:00
|
|
|
render={({ match }) => (
|
|
|
|
<TransactionDetails signature={match.params.signature} />
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
<Route exact path={TX_ALIASES.map(tx => `/${tx}s`)}>
|
|
|
|
<TabbedPage tab="Transactions">
|
2020-04-24 08:12:37 -07:00
|
|
|
<TransactionsCard />
|
2020-04-29 05:48:38 -07:00
|
|
|
</TabbedPage>
|
|
|
|
</Route>
|
2020-05-12 03:32:14 -07:00
|
|
|
<Route
|
|
|
|
exact
|
|
|
|
path={ACCOUNT_ALIASES.concat(ACCOUNT_ALIASES_PLURAL).map(
|
|
|
|
account => `/${account}/:address`
|
|
|
|
)}
|
|
|
|
render={({ match }) => (
|
|
|
|
<AccountDetails address={match.params.address} />
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
<Route exact path={ACCOUNT_ALIASES_PLURAL.map(alias => "/" + alias)}>
|
2020-04-29 05:48:38 -07:00
|
|
|
<TabbedPage tab="Accounts">
|
2020-04-24 08:12:37 -07:00
|
|
|
<AccountsCard />
|
2020-04-29 05:48:38 -07:00
|
|
|
</TabbedPage>
|
|
|
|
</Route>
|
|
|
|
<Route
|
|
|
|
render={({ location }) => (
|
|
|
|
<Redirect to={{ ...location, pathname: "/transactions" }} />
|
|
|
|
)}
|
|
|
|
></Route>
|
|
|
|
</Switch>
|
2020-04-24 05:11:30 -07:00
|
|
|
</div>
|
|
|
|
</>
|
2020-03-13 02:07:58 -07:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default App;
|