@@ -5,6 +5,10 @@ import { ExternalLinkIcon, XIcon } from "lucide-react";
55import Link from "next/link" ;
66import { useState } from "react" ;
77import type { ThirdwebClient } from "thirdweb" ;
8+ import {
9+ DateRangeSelector ,
10+ type Range ,
11+ } from "@/components/analytics/date-range-selector" ;
812import { SingleNetworkSelector } from "@/components/blocks/NetworkSelectors" ;
913import { PaginationButtons } from "@/components/blocks/pagination-buttons" ;
1014import { WalletAddress } from "@/components/blocks/wallet-address" ;
@@ -35,15 +39,15 @@ type DedicatedRelayerActiveStateProps = {
3539 teamId : string ;
3640 fleetId : string ;
3741 client : ThirdwebClient ;
38- from : string ;
39- to : string ;
42+ range : Range ;
43+ setRange : ( range : Range ) => void ;
4044 className ?: string ;
4145} ;
4246
4347export function DedicatedRelayerActiveState (
4448 props : DedicatedRelayerActiveStateProps ,
4549) {
46- const { fleet, teamId, fleetId, client, from , to } = props ;
50+ const { fleet, teamId, fleetId, client, range , setRange } = props ;
4751
4852 const pageSize = 10 ;
4953 const [ page , setPage ] = useState ( 1 ) ;
@@ -52,15 +56,15 @@ export function DedicatedRelayerActiveState(
5256 const summaryQuery = useFleetTransactionsSummary ( {
5357 teamId,
5458 fleetId,
55- from,
56- to,
59+ from : range . from . toISOString ( ) ,
60+ to : range . to . toISOString ( ) ,
5761 } ) ;
5862
5963 const transactionsQuery = useFleetTransactions ( {
6064 teamId,
6165 fleetId,
62- from,
63- to,
66+ from : range . from . toISOString ( ) ,
67+ to : range . to . toISOString ( ) ,
6468 limit : pageSize ,
6569 offset : ( page - 1 ) * pageSize ,
6670 chainId : chainIdFilter ,
@@ -70,8 +74,18 @@ export function DedicatedRelayerActiveState(
7074 ? Math . ceil ( transactionsQuery . data . meta . total / pageSize )
7175 : 0 ;
7276
77+ // Filter active chains to only include those in the fleet
78+ const activeChainsCount =
79+ summaryQuery . data ?. data . transactionsByChain . filter ( ( c ) =>
80+ fleet . chainIds . includes ( Number ( c . chainId ) ) ,
81+ ) . length ?? 0 ;
82+
7383 return (
7484 < div className = { cn ( "flex flex-col gap-6" , props . className ) } >
85+ < div className = "flex justify-end" >
86+ < DateRangeSelector range = { range } setRange = { setRange } />
87+ </ div >
88+
7589 { /* Summary Stats */ }
7690 < div className = "grid gap-4 md:grid-cols-3" >
7791 < StatCard
@@ -92,9 +106,7 @@ export function DedicatedRelayerActiveState(
92106 />
93107 < StatCard
94108 title = "Active Chains"
95- value = {
96- summaryQuery . data ?. data . transactionsByChain . length . toString ( ) ?? "—"
97- }
109+ value = { summaryQuery . data ? activeChainsCount . toString ( ) : "—" }
98110 isLoading = { summaryQuery . isPending }
99111 />
100112 </ div >
@@ -132,6 +144,7 @@ export function DedicatedRelayerActiveState(
132144 setPage ( 1 ) ;
133145 } }
134146 client = { client }
147+ chainIds = { fleet . chainIds }
135148 />
136149 </ div >
137150 </ div >
@@ -143,7 +156,6 @@ export function DedicatedRelayerActiveState(
143156 < TableHead > Transaction Hash</ TableHead >
144157 < TableHead > Chain</ TableHead >
145158 < TableHead > Wallet</ TableHead >
146- < TableHead > Executor</ TableHead >
147159 < TableHead > Timestamp</ TableHead >
148160 < TableHead > Fee</ TableHead >
149161 </ TableRow >
@@ -244,9 +256,6 @@ function TransactionRow(props: {
244256 < TableCell >
245257 < WalletAddress address = { transaction . walletAddress } client = { client } />
246258 </ TableCell >
247- < TableCell >
248- < WalletAddress address = { transaction . executorAddress } client = { client } />
249- </ TableCell >
250259 < TableCell >
251260 < ToolTipLabel hoverable label = { format ( new Date ( utcTimestamp ) , "PPpp" ) } >
252261 < span >
@@ -275,9 +284,6 @@ function SkeletonRow() {
275284 < TableCell >
276285 < Skeleton className = "h-7 w-[130px]" />
277286 </ TableCell >
278- < TableCell >
279- < Skeleton className = "h-7 w-[130px]" />
280- </ TableCell >
281287 < TableCell >
282288 < Skeleton className = "h-7 w-[80px]" />
283289 </ TableCell >
@@ -350,7 +356,10 @@ function ChainCell(props: { chainId: string; client: ThirdwebClient }) {
350356 ) ;
351357}
352358
353- function TransactionFeeCell ( props : { usdValue : number } ) {
359+ function TransactionFeeCell ( props : { usdValue : number | null } ) {
360+ if ( props . usdValue === null ) {
361+ return < span className = "font-mono text-sm text-muted-foreground" > —</ span > ;
362+ }
354363 return (
355364 < span className = "font-mono text-sm" >
356365 ${ props . usdValue < 0.01 ? "<0.01" : props . usdValue . toFixed ( 2 ) }
@@ -362,6 +371,7 @@ function ChainFilter(props: {
362371 chainId : number | undefined ;
363372 setChainId : ( chainId : number | undefined ) => void ;
364373 client : ThirdwebClient ;
374+ chainIds : number [ ] ;
365375} ) {
366376 return (
367377 < div className = "flex bg-background" >
@@ -373,6 +383,7 @@ function ChainFilter(props: {
373383 align = "end"
374384 placeholder = "All Chains"
375385 className = "min-w-[150px]"
386+ chainIds = { props . chainIds }
376387 />
377388 </ div >
378389 ) ;
0 commit comments