web: add guardians page

This commit is contained in:
Evan Gray 2022-09-27 21:10:04 -04:00 committed by Evan Gray
parent 73a8df35e4
commit c86a917d4d
3 changed files with 25 additions and 10 deletions

View File

@ -19,7 +19,8 @@ import {
import CustomThemeProvider from "./components/CustomThemeProvider"; import CustomThemeProvider from "./components/CustomThemeProvider";
import ErrorFallback from "./components/ErrorFallback"; import ErrorFallback from "./components/ErrorFallback";
import Governance from "./components/Governance"; import Governance from "./components/Governance";
import Main from "./components/Main"; import Guardians from "./components/Guardians";
import Home from "./components/Home";
import { NetworkContextProvider } from "./contexts/NetworkContext"; import { NetworkContextProvider } from "./contexts/NetworkContext";
import { SettingsContextProvider } from "./contexts/SettingsContext"; import { SettingsContextProvider } from "./contexts/SettingsContext";
import WormholeStatsIcon from "./icons/WormholeStatsIcon"; import WormholeStatsIcon from "./icons/WormholeStatsIcon";
@ -50,6 +51,9 @@ function App() {
<Button component={Link} to="/governance"> <Button component={Link} to="/governance">
Governance Governance
</Button> </Button>
<Button component={Link} to="/guardians">
Guardians
</Button>
</Box> </Box>
<Box flexGrow={1} /> <Box flexGrow={1} />
<Box> <Box>
@ -66,11 +70,14 @@ function App() {
</Toolbar> </Toolbar>
</AppBar> </AppBar>
<Switch> <Switch>
<Route exact path="/guardians">
<Guardians />
</Route>
<Route exact path="/governance"> <Route exact path="/governance">
<Governance /> <Governance />
</Route> </Route>
<Route exact path="/"> <Route exact path="/">
<Main /> <Home />
</Route> </Route>
<Route> <Route>
<Redirect to="/" /> <Redirect to="/" />

View File

@ -1,4 +1,4 @@
import { Card } from "@mui/material"; import { Box, Card, Typography } from "@mui/material";
import { import {
createColumnHelper, createColumnHelper,
getCoreRowModel, getCoreRowModel,
@ -7,7 +7,7 @@ import {
useReactTable, useReactTable,
} from "@tanstack/react-table"; } from "@tanstack/react-table";
import { useState } from "react"; import { useState } from "react";
import { HeartbeatResponse } from "../hooks/useHeartbeats"; import useHeartbeats, { HeartbeatResponse } from "../hooks/useHeartbeats";
import longToDate from "../utils/longToDate"; import longToDate from "../utils/longToDate";
import Table from "./Table"; import Table from "./Table";
@ -43,10 +43,16 @@ const columns = [
}), }),
columnHelper.accessor("guardianaddr", { columnHelper.accessor("guardianaddr", {
header: () => "Address", header: () => "Address",
cell: (info) => (
<Box component="pre" m={0}>
{info.getValue()}
</Box>
),
}), }),
]; ];
function Guardians({ heartbeats }: { heartbeats: HeartbeatResponse[] }) { function Guardians() {
const heartbeats = useHeartbeats();
const [sorting, setSorting] = useState<SortingState>([]); const [sorting, setSorting] = useState<SortingState>([]);
const table = useReactTable({ const table = useReactTable({
columns, columns,
@ -60,9 +66,11 @@ function Guardians({ heartbeats }: { heartbeats: HeartbeatResponse[] }) {
onSortingChange: setSorting, onSortingChange: setSorting,
}); });
return ( return (
<Card> <Box m={2}>
<Table<HeartbeatResponse> table={table} /> <Card>
</Card> <Table<HeartbeatResponse> table={table} />
</Card>
</Box>
); );
} }

View File

@ -4,7 +4,7 @@ import useHeartbeats from "../hooks/useHeartbeats";
import Chains from "./Chains"; import Chains from "./Chains";
import LatestVAAs from "./LatestVAAs"; import LatestVAAs from "./LatestVAAs";
function Main() { function Home() {
const heartbeats = useHeartbeats(); const heartbeats = useHeartbeats();
const chainIdsToHeartbeats = useChainHeartbeats(heartbeats); const chainIdsToHeartbeats = useChainHeartbeats(heartbeats);
return ( return (
@ -14,4 +14,4 @@ function Main() {
</Box> </Box>
); );
} }
export default Main; export default Home;