-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #272 from alleslabs/pages/block-list
feat: (WIP) blocks page w/o proposer
- Loading branch information
Showing
13 changed files
with
493 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import type { GridProps } from "@chakra-ui/react"; | ||
import { Grid } from "@chakra-ui/react"; | ||
|
||
import { TableHeader } from "lib/components/table"; | ||
|
||
interface BlocksHeaderProps { | ||
templateColumns: GridProps["templateColumns"]; | ||
scrollComponentId: string; | ||
} | ||
|
||
export const BlocksHeader = ({ | ||
templateColumns, | ||
scrollComponentId, | ||
}: BlocksHeaderProps) => { | ||
return ( | ||
<Grid templateColumns={templateColumns} id={scrollComponentId}> | ||
<TableHeader>Block Height</TableHeader> | ||
<TableHeader>Block Hash</TableHeader> | ||
<TableHeader>Proposed by</TableHeader> | ||
<TableHeader textAlign="center">Transactions</TableHeader> | ||
<TableHeader>Timestamp</TableHeader> | ||
</Grid> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import type { GridProps } from "@chakra-ui/react"; | ||
import { Flex, Text, Grid } from "@chakra-ui/react"; | ||
|
||
import { ExplorerLink } from "lib/components/ExplorerLink"; | ||
import { TableRow } from "lib/components/table"; | ||
import type { BlockInfo } from "lib/types/block"; | ||
import { dateFromNow, formatUTC, truncate } from "lib/utils"; | ||
|
||
interface BlocksRowProps { | ||
templateColumns: GridProps["templateColumns"]; | ||
blockData: BlockInfo; | ||
} | ||
|
||
export const BlocksRow = ({ templateColumns, blockData }: BlocksRowProps) => { | ||
return ( | ||
<Grid templateColumns={templateColumns}> | ||
<TableRow> | ||
<ExplorerLink | ||
type="block_height" | ||
value={blockData.height} | ||
showCopyOnHover | ||
> | ||
{blockData.height} | ||
</ExplorerLink> | ||
</TableRow> | ||
<TableRow>{truncate(blockData.hash.toUpperCase())}</TableRow> | ||
{/* TODO: Wireup Proposer */} | ||
<TableRow>mitovaloper325KJNUFNU12N4J1KBTDXD</TableRow> | ||
<TableRow justifyContent="center">{blockData.txCount}</TableRow> | ||
<TableRow> | ||
<Flex direction="column"> | ||
<Text variant="body2" color="text.dark" mb="2px"> | ||
{formatUTC(blockData.timestamp)} | ||
</Text> | ||
<Text variant="body3" color="text.disabled"> | ||
({dateFromNow(blockData.timestamp)}) | ||
</Text> | ||
</Flex> | ||
</TableRow> | ||
</Grid> | ||
); | ||
}; |
Oops, something went wrong.