Skip to content

Commit

Permalink
fix(web): add decoded fields section fixes (#606)
Browse files Browse the repository at this point in the history
* fix(web): rename decoded fields section

* fix(web): hide decoded fields section when no decoded fields are available

* chore: add changeset

* style(web): remove redundant check
  • Loading branch information
PJColombo authored Oct 25, 2024
1 parent 548641b commit ba1d783
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 78 deletions.
5 changes: 5 additions & 0 deletions .changeset/fast-starfishes-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@blobscan/web": patch
---

Removed "transaction" from decoded fields header
5 changes: 5 additions & 0 deletions .changeset/six-wasps-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@blobscan/web": patch
---

Hid decoded fields section when there is no decoded data available
154 changes: 76 additions & 78 deletions apps/web/src/pages/tx/[hash].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,84 +256,82 @@ const Tx: NextPage = () => {
fields={detailsFields}
/>

{rawTxData && rawTxData.decodedFields && (
<Card header="Decoded transaction fields">
{decodedData && (
<div>
<InfoGrid
fields={[
{
name: "Timestamp since L2 genesis",
value: (
<div className="whitespace-break-spaces">
{formatTimestamp(decodedData.timestampSinceL2Genesis)}
</div>
),
},
{
name: "Last L1 origin number",
value: decodedData.lastL1OriginNumber,
},
{
name: "Parent L2 block hash",
value: (
<div className="flex items-center gap-2">
<Link
href={
"https://etherscan.io/block/" +
"0x" +
decodedData.parentL2BlockHash
}
>
{"0x" + decodedData.parentL2BlockHash}
</Link>
<CopyToClipboard
value={"0x" + decodedData.parentL2BlockHash}
label="Copy parent L2 block hash"
/>
</div>
),
},
{
name: "L1 origin block hash",
value: (
<div className="flex items-center gap-2">
<Link
href={
"https://etherscan.io/block/" +
"0x" +
decodedData.l1OriginBlockHash
}
>
{"0x" + decodedData.l1OriginBlockHash}
</Link>
<CopyToClipboard
value={"0x" + decodedData.l1OriginBlockHash}
label="Copy L1 origin block hash"
/>
</div>
),
},
{
name: "Number of L2 blocks",
value: decodedData.numberOfL2Blocks,
},
{
name: "Changed by L1 origin",
value: decodedData.changedByL1Origin,
},
{
name: "Total transactions",
value: decodedData.totalTxs,
},
{
name: "Contract creation transactions",
value: decodedData.contractCreationTxsNumber,
},
]}
/>
</div>
)}
{decodedData && (
<Card header="Decoded Fields">
<div>
<InfoGrid
fields={[
{
name: "Timestamp since L2 genesis",
value: (
<div className="whitespace-break-spaces">
{formatTimestamp(decodedData.timestampSinceL2Genesis)}
</div>
),
},
{
name: "Last L1 origin number",
value: decodedData.lastL1OriginNumber,
},
{
name: "Parent L2 block hash",
value: (
<div className="flex items-center gap-2">
<Link
href={
"https://etherscan.io/block/" +
"0x" +
decodedData.parentL2BlockHash
}
>
{"0x" + decodedData.parentL2BlockHash}
</Link>
<CopyToClipboard
value={"0x" + decodedData.parentL2BlockHash}
label="Copy parent L2 block hash"
/>
</div>
),
},
{
name: "L1 origin block hash",
value: (
<div className="flex items-center gap-2">
<Link
href={
"https://etherscan.io/block/" +
"0x" +
decodedData.l1OriginBlockHash
}
>
{"0x" + decodedData.l1OriginBlockHash}
</Link>
<CopyToClipboard
value={"0x" + decodedData.l1OriginBlockHash}
label="Copy L1 origin block hash"
/>
</div>
),
},
{
name: "Number of L2 blocks",
value: decodedData.numberOfL2Blocks,
},
{
name: "Changed by L1 origin",
value: decodedData.changedByL1Origin,
},
{
name: "Total transactions",
value: decodedData.totalTxs,
},
{
name: "Contract creation transactions",
value: decodedData.contractCreationTxsNumber,
},
]}
/>
</div>
</Card>
)}

Expand Down

0 comments on commit ba1d783

Please sign in to comment.