From 0cc0c5f9467bd4e5bc9aca6268c6c56a6ea86cbb Mon Sep 17 00:00:00 2001 From: karooolis Date: Thu, 3 Oct 2024 10:00:33 +0300 Subject: [PATCH] up/down state, expanded styling --- .../observe/TransactionTableRow.tsx | 62 ++++++++++++------- .../observe/TransactionsTableView.tsx | 2 +- 2 files changed, 39 insertions(+), 25 deletions(-) diff --git a/packages/explorer/src/app/(explorer)/[chainName]/worlds/[worldAddress]/observe/TransactionTableRow.tsx b/packages/explorer/src/app/(explorer)/[chainName]/worlds/[worldAddress]/observe/TransactionTableRow.tsx index 2d851ec5b7..10b8675b3a 100644 --- a/packages/explorer/src/app/(explorer)/[chainName]/worlds/[worldAddress]/observe/TransactionTableRow.tsx +++ b/packages/explorer/src/app/(explorer)/[chainName]/worlds/[worldAddress]/observe/TransactionTableRow.tsx @@ -1,8 +1,10 @@ +import { ChevronDownIcon, ChevronUpIcon } from "lucide-react"; import { formatEther } from "viem"; import { Row, flexRender } from "@tanstack/react-table"; import { Separator } from "../../../../../../components/ui/Separator"; import { Skeleton } from "../../../../../../components/ui/Skeleton"; import { TableCell, TableRow } from "../../../../../../components/ui/Table"; +import { cn } from "../../../../../../utils"; import { Confirmations } from "./Confirmations"; import { WatchedTransaction } from "./TransactionsTableContainer"; import { columns } from "./TransactionsTableView"; @@ -10,7 +12,7 @@ import { columns } from "./TransactionsTableView"; function TranctionTableRowDataCell({ label, children }: { label: string; children: React.ReactNode }) { return (
-

{label}

+

{label}

{children ?? }

); @@ -23,14 +25,25 @@ export function TransactionTableRow({ row }: { row: Row }) { return ( <> - row.toggleExpanded()}> + row.toggleExpanded()} + > {row.getVisibleCells().map((cell) => ( {flexRender(cell.column.columnDef.cell, cell.getContext())} ))} + + {row.getIsExpanded() ? ( + + ) : ( + + )} {row.getIsExpanded() && ( - + {data && ( <> @@ -46,46 +59,47 @@ export function TransactionTableRow({ row }: { row: Row }) { {receipt?.effectiveGasPrice.toString()} - {receipt?.gasUsed && receipt?.effectiveGasPrice - ? `${formatEther(receipt.gasUsed * receipt.effectiveGasPrice)} ETH` - : null} + {receipt ? `${formatEther(receipt.gasUsed * receipt.effectiveGasPrice)} ETH` : null} -
-

Error

- {data.error ? ( -
- {data.error.message} -
- ) : ( -

No error

- )} -
- - -

Inputs

{Array.isArray(data.functionData?.args) && data.functionData?.args.length > 0 ? (
{data.functionData?.args?.map((arg, idx) => (
- arg {idx + 1}: + arg {idx + 1}: {String(arg)}
))}
) : ( -

No inputs

+

No inputs

)}
+ {data.error ? ( + <> + +
+

Error

+ {data.error ? ( +
+ {data.error.message} +
+ ) : ( +

No error

+ )} +
+ + ) : null} + -
+

Logs

{Array.isArray(logs) && logs.length > 0 ? (
@@ -100,7 +114,7 @@ export function TransactionTableRow({ row }: { row: Row }) {
    {Object.entries(args).map(([key, value]) => (
  • - {key}: + {key}: {value as never}
  • ))} @@ -113,7 +127,7 @@ export function TransactionTableRow({ row }: { row: Row }) {
) : ( -

No logs

+

No logs

)}
diff --git a/packages/explorer/src/app/(explorer)/[chainName]/worlds/[worldAddress]/observe/TransactionsTableView.tsx b/packages/explorer/src/app/(explorer)/[chainName]/worlds/[worldAddress]/observe/TransactionsTableView.tsx index 76f6c451e2..62975e804d 100644 --- a/packages/explorer/src/app/(explorer)/[chainName]/worlds/[worldAddress]/observe/TransactionsTableView.tsx +++ b/packages/explorer/src/app/(explorer)/[chainName]/worlds/[worldAddress]/observe/TransactionsTableView.tsx @@ -94,7 +94,7 @@ export function TransactionsTableView({ data }: { data: WatchedTransaction[] }) return ( - + {table.getHeaderGroups().map((headerGroup) => ( {headerGroup.headers.map((header) => {