From f44d6ba2827d7d7391425a5ddb2d49cafdc934bb Mon Sep 17 00:00:00 2001 From: MananTank Date: Fri, 30 May 2025 23:41:53 +0000 Subject: [PATCH] [TOOL-4648] Dashboard: Fix timestamp in sponsored transactions table (#7236) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ## PR-Codex overview This PR focuses on refactoring the rendering logic of the `SponsoredTransactionsTableUI` component to improve clarity and functionality, particularly around handling timestamps and the rendering of table rows. ### Detailed summary - Changed the way `transaction.timestamp` is handled to ensure it always ends with "Z". - Simplified the mapping of `props.sponsoredTransactions` to use a block body for clarity. - Added `client` prop to `ProjectCell`. - Enhanced readability of the table structure by removing unnecessary code. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` ## Summary by CodeRabbit - **Bug Fixes** - Improved accuracy of transaction timestamps by ensuring all are treated as UTC. - Enhanced consistency in date and time display for sponsored transactions. - **New Features** - Added support for passing client information to project, chain, and wallet address displays in the transactions table. --- .../SponsoredTransactionsTableUI.tsx | 128 +++++++++--------- 1 file changed, 67 insertions(+), 61 deletions(-) diff --git a/apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/overview/components/SponsoredTransactionsTableUI.tsx b/apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/overview/components/SponsoredTransactionsTableUI.tsx index 65eee10eec4..b26e35753b2 100644 --- a/apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/overview/components/SponsoredTransactionsTableUI.tsx +++ b/apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/usage/overview/components/SponsoredTransactionsTableUI.tsx @@ -124,71 +124,77 @@ export function SponsoredTransactionsTableUI( {!props.isPending - ? props.sponsoredTransactions.map((transaction) => ( - - {/* Tx Hash */} - - - - - {/* Project */} - {props.variant === "team" && ( + ? props.sponsoredTransactions.map((transaction) => { + const utcTimestamp = transaction.timestamp.endsWith("Z") + ? transaction.timestamp + : `${transaction.timestamp}Z`; + + return ( + + {/* Tx Hash */} - p.id === transaction.projectId, - )} + + + + {/* Project */} + {props.variant === "team" && ( + + p.id === transaction.projectId, + )} + client={props.client} + /> + + )} + + {/* Chain */} + + + + + {/* Wallet */} + + - )} - - {/* Chain */} - - - - - {/* Wallet */} - - - - - {/* Time */} - - - - {formatDistance( - new Date(transaction.timestamp), - new Date(), - { - addSuffix: true, - }, - )} - - - - - {/* Fee */} - - - - - )) + + {/* Time */} + + + + {formatDistance( + new Date(utcTimestamp), + new Date(), + { + addSuffix: true, + }, + )} + + + + + {/* Fee */} + + + + + ); + }) : Array.from({ length: props.pageSize }).map((_, index) => (