Skip to content

Commit ef0adf1

Browse files
committed
Merge branch 'feat/add-block-status-to-table' of github.com:aztec-scan/chicmoz into bug/ethereum-genesis-catchup
2 parents ce94bc3 + c7bd3f3 commit ef0adf1

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

services/explorer-ui/src/components/blocks/block-table-columns.tsx

+7-6
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ import { formatTimeSince } from "~/lib/utils";
55
import { routes } from "~/routes/__root";
66
import type { BlockTableSchema } from "./blocks-schema";
77
import { truncateHashString } from "~/lib/create-hash-string";
8+
import { BlockStatusBadge } from "../block-status-badge";
89

910
const text = {
1011
height: "HEIGHT",
1112
blockHash: "BLOCK HASH",
1213
txEffectsLength: "NBR OF TXS",
13-
totalFees: "FEES (FPA)",
1414
timeSince: "AGE",
15+
blockStatus: "BLOCK STATUS"
1516
};
1617

1718
export const BlockTableColumns: ColumnDef<BlockTableSchema>[] = [
@@ -48,7 +49,7 @@ export const BlockTableColumns: ColumnDef<BlockTableSchema>[] = [
4849
),
4950
cell: ({ row }) => {
5051
const blockHash = row.getValue("blockHash");
51-
if (typeof blockHash !== "string") return null;
52+
if (typeof blockHash !== "string") { return null; }
5253
const r = `${routes.blocks.route}/${blockHash}`;
5354
return (
5455
<div className="text-purple-light font-mono">
@@ -94,18 +95,18 @@ export const BlockTableColumns: ColumnDef<BlockTableSchema>[] = [
9495
enableHiding: false,
9596
},
9697
{
97-
accessorKey: "totalFees",
98+
accessorKey: "blockStatus",
9899
header: ({ column }) => (
99100
<DataTableColumnHeader
100101
className="text-purple-dark text-sm"
101102
column={column}
102-
title={text.totalFees}
103+
title={text.blockStatus}
103104
/>
104105
),
105106
cell: ({ row }) => (
106-
<div className="font-mono">{row.getValue("totalFees")}</div>
107+
<BlockStatusBadge className="font-mono" status={row.getValue("blockStatus")} />
107108
),
108-
enableSorting: true,
109+
enableSorting: false,
109110
enableHiding: false,
110111
},
111112
];
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { chicmozL2BlockFinalizationStatusSchema } from "@chicmoz-pkg/types";
12
import { z } from "zod";
23

34
export type BlockTableSchema = z.infer<typeof blockSchema>;
@@ -6,7 +7,7 @@ export const blockSchema = z.object({
67
height: z.coerce.number(),
78
blockHash: z.string(),
89
txEffectsLength: z.number(),
9-
totalFees: z.coerce.string(),
1010
totalManaUsed: z.coerce.string(),
11+
blockStatus: chicmozL2BlockFinalizationStatusSchema,
1112
timestamp: z.number(),
1213
});

services/explorer-ui/src/pages/landing/util.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ export const mapLatestBlocks = (latestBlocks?: ChicmozL2BlockLight[]) => {
1717
height: block.height,
1818
blockHash: block.hash,
1919
txEffectsLength: block.body.txEffects.length,
20-
totalFees: block.header.totalFees,
2120
timestamp: block.header.globalVariables.timestamp,
21+
blockStatus: block.finalizationStatus,
2222
});
2323
});
2424
};

0 commit comments

Comments
 (0)