Skip to content

Commit

Permalink
feat: add category column to blob and transaction tables (#623)
Browse files Browse the repository at this point in the history
* feat(web): add category column to blob and transaction tables

* chore(web): update changeset

* fix(web): add 'category' to blob on transaction entity

* refactor(web): merge 'category' and 'rollup' columns

* fix: update missing test snapshots

* feat(web): add rollup icon to start of the rows

* feat(web): add rollups in blocks table

* chore(web): update api changeset

* chore(web): update snapshot

* refactor(web): simplify table category conditional statements

* refactor(web): remove scale styles for rollups icons in blocks table

* fix(web): fix rollups list alignment in blocks table
  • Loading branch information
xFJA authored Dec 2, 2024
1 parent 8f4e316 commit 025484b
Show file tree
Hide file tree
Showing 9 changed files with 356 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .changeset/chatty-pears-drum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@blobscan/api": minor
---

Added transaction category column to blob data.
5 changes: 5 additions & 0 deletions .changeset/pink-pots-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@blobscan/web": minor
---

Added category column to blob, block and transaction tables.
14 changes: 14 additions & 0 deletions apps/web/src/pages/blobs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Filters } from "~/components/Filters";
import { Header } from "~/components/Header";
import { Link } from "~/components/Link";
import { PaginatedTable } from "~/components/PaginatedTable";
import { RollupIcon } from "~/components/RollupIcon";
import { Skeleton } from "~/components/Skeleton";
import { StorageIcon } from "~/components/StorageIcon";
import { api } from "~/api-client";
Expand All @@ -24,6 +25,10 @@ import {
const BLOBS_TABLE_HEADERS = [
{
cells: [
{
item: "",
className: "w-[40px]",
},
{
item: "Versioned Hash",
className: "2xl:w-[312px] xl:w-[276px] lg:w-[215px] w-[170px]",
Expand Down Expand Up @@ -84,8 +89,17 @@ const Blobs: NextPage = function () {
txHash,
blockTimestamp,
blockNumber,
transaction,
}) => ({
cells: [
{
item:
transaction?.category === "rollup" && transaction.rollup ? (
<RollupIcon rollup={transaction.rollup} />
) : (
<></>
),
},
{
item: (
<Copyable
Expand Down
33 changes: 32 additions & 1 deletion apps/web/src/pages/blocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Filters } from "~/components/Filters";
import { Header } from "~/components/Header";
import { Link } from "~/components/Link";
import { PaginatedTable } from "~/components/PaginatedTable";
import { RollupIcon } from "~/components/RollupIcon";
import { Skeleton } from "~/components/Skeleton";
import { Table } from "~/components/Table";
import { api } from "~/api-client";
Expand All @@ -26,6 +27,10 @@ import {
export const BLOCKS_TABLE_HEADERS = [
{
cells: [
{
item: "",
className: "w-[100px]",
},
{
item: "Block number",
className: "2xl:w-[187px] lg:w-[158px] w-[118px]",
Expand Down Expand Up @@ -110,6 +115,7 @@ const Blocks: NextPage = function () {
const headers = [
{
cells: [
{ item: "" },
{
item: "Tx Hash",
},
Expand All @@ -127,12 +133,22 @@ const Blocks: NextPage = function () {
transaction.blobs.map((blob) => ({
transactionHash: transaction.hash,
blobVersionedHash: blob.versionedHash,
category: transaction.category,
rollup: transaction.rollup,
}))
);

const rows = transactionsCombinedWithInnerBlobs.map(
({ transactionHash, blobVersionedHash }) => ({
({ transactionHash, blobVersionedHash, rollup, category }) => ({
cells: [
{
item:
category === "rollup" && rollup ? (
<RollupIcon rollup={rollup} />
) : (
<></>
),
},
{
item: (
<Copyable
Expand Down Expand Up @@ -174,6 +190,21 @@ const Blocks: NextPage = function () {

return {
cells: [
{
item: (
<div className="relative flex">
{transactions.map((tx, i) => {
return tx.rollup ? (
<div key={i} className="-ml-1 first-of-type:ml-0">
<RollupIcon rollup={tx.rollup} />
</div>
) : (
<></>
);
})}
</div>
),
},
{
item: (
<Copyable
Expand Down
19 changes: 12 additions & 7 deletions apps/web/src/pages/txs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ type Transaction = Pick<
| "blobGasMaxFee"
| "block"
| "blockTimestamp"
| "category"
> & { blobsLength?: number };

export const TRANSACTIONS_TABLE_HEADERS = [
{
cells: [
{ item: "", className: "w-[40px]" },
{
item: "Hash",
className: "w-[150px]",
Expand All @@ -64,10 +66,7 @@ export const TRANSACTIONS_TABLE_HEADERS = [
item: "To",
className: "w-[148px]",
},
{
item: "Rollup",
className: "w-[72px]",
},

{
item: "Blob Base Fee",
className: "w-[172px]",
Expand Down Expand Up @@ -128,6 +127,7 @@ const Txs: NextPage = function () {
to,
blobs,
rollup,
category,
blockNumber,
blobGasBaseFee,
blobGasMaxFee,
Expand Down Expand Up @@ -202,6 +202,14 @@ const Txs: NextPage = function () {

return {
cells: [
{
item:
category === "rollup" && rollup ? (
<RollupIcon rollup={rollup} />
) : (
<></>
),
},
{
item: (
<Copyable value={hash} tooltipText="Copy hash">
Expand Down Expand Up @@ -244,9 +252,6 @@ const Txs: NextPage = function () {
</Copyable>
),
},
{
item: rollup ? <RollupIcon rollup={rollup} /> : <></>,
},
{
item: (
<div className="truncate">
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/routers/blob/common/selects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export function createBlobSelect(expands: Expands) {
transaction: {
select: {
rollup: true,
category: true,
...(expands.transaction?.select ?? {}),
},
},
Expand Down Expand Up @@ -56,6 +55,7 @@ export function createBlobsOnTransactionsSelect(expands: Expands) {
transaction: {
select: {
rollup: true,
category: true,
...(expands.transaction?.select ?? {}),
},
},
Expand Down
2 changes: 2 additions & 0 deletions packages/api/src/utils/selects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ export const blobsOnTransactionsReferencesSelect =
export const transactionReferenceSelect =
Prisma.validator<Prisma.TransactionSelect>()({
hash: true,
rollup: true,
category: true,
});
Loading

0 comments on commit 025484b

Please sign in to comment.