From a5cb60a8802c501124224c85ba83a1371bd15eea Mon Sep 17 00:00:00 2001 From: Mohammad Kermani Date: Tue, 26 Sep 2023 12:15:43 +0000 Subject: [PATCH] refactor(watcher-app): refactor events table columns --- apps/watcher/app/events/TableRow.tsx | 157 ++++++++++++++++++++++----- 1 file changed, 131 insertions(+), 26 deletions(-) diff --git a/apps/watcher/app/events/TableRow.tsx b/apps/watcher/app/events/TableRow.tsx index a964e8f3..d9e6ad1b 100644 --- a/apps/watcher/app/events/TableRow.tsx +++ b/apps/watcher/app/events/TableRow.tsx @@ -1,11 +1,18 @@ import { useState, FC, useMemo } from 'react'; -import { Button, EnhancedTableCell, TableRow } from '@rosen-bridge/ui-kit'; +import { + Button, + EnhancedTableCell, + Link, + TableRow, +} from '@rosen-bridge/ui-kit'; import { AngleDown, AngleUp } from '@rosen-bridge/icons'; import { Event } from '@rosen-ui/types'; +import { CARDANO_BASE_TX_URL, ERGO_BASE_TX_URL } from '@/_constants'; + interface RowProps extends Event { isLoading?: boolean; } @@ -27,19 +34,31 @@ export const mobileHeader = [ export const tabletHeader = [ { - title: 'ID', + title: 'Tx Id', + cellProps: { + width: 150, + }, + }, + { + title: 'Token Id', + cellProps: { + width: 150, + }, + }, + { + title: 'From Address', cellProps: { width: 150, }, }, { - title: 'From', + title: 'To Address', cellProps: { - width: 250, + width: 150, }, }, { - title: 'To', + title: 'Height', cellProps: { width: 150, }, @@ -48,50 +67,112 @@ export const tabletHeader = [ title: 'Amount', cellProps: { width: 150, - align: 'right' as const, + }, + }, + { + title: 'Bridge Fee', + cellProps: { + width: 150, + }, + }, + { + title: 'Network Fee', + cellProps: { + width: 150, + }, + }, + { + title: 'Event Id', + cellProps: { + width: 150, + }, + }, + { + title: 'Reports', + cellProps: { + width: 150, + }, + }, + { + title: 'Status', + cellProps: { + width: 150, }, }, ]; -const renderValue = (value?: string | number | undefined) => { - return value || '-'; -}; - export const MobileRow: FC = (props) => { const { isLoading, ...row } = props; const [expand, setExpand] = useState(false); const rowStyles = useMemo( () => (isLoading ? { opacity: 0.3 } : {}), - [isLoading] + [isLoading], ); const toggleExpand = () => { setExpand((prevState) => !prevState); }; + const baseTxUrl = + row.fromChain === 'ergo' ? ERGO_BASE_TX_URL : CARDANO_BASE_TX_URL; + return ( <> - - Id - {row.eventId} - - - - From chain + + Tx Id + + + {row.sourceTxId.slice(0, 8)} + - {row.fromChain} - - To chain - {row.toChain} + + Token Id + + {row.sourceChainTokenId.slice(0, 8)} + {expand && ( <> + + From Address + {row.fromAddress.slice(0, 8)} + + + To Address + {row.toAddress.slice(0, 8)} + + + Height + {row.height} + Amount {row.amount} + + Bridge Fee + {row.bridgeFee} + + + Network Fee + {row.networkFee} + + + Event Id + {row.eventId.slice(0, 8)} + + + Reports + {row.WIDs.split(',').length} + + + Status + + {row.spendBlock ? 'Completed' : 'Incomplete'} + + )} @@ -113,12 +194,36 @@ export const MobileRow: FC = (props) => { export const TabletRow: FC = (props) => { const { isLoading, ...row } = props; + + const baseTxUrl = + row.fromChain === 'ergo' ? ERGO_BASE_TX_URL : CARDANO_BASE_TX_URL; + return ( - {row.eventId} - {row.fromChain} - {row.toChain} - {row.amount} + + + {row.sourceTxId.slice(0, 8)} + + + + {row.sourceChainTokenId.slice(0, 8)} + + {row.fromAddress.slice(0, 8)} + {row.toAddress.slice(0, 8)} + {row.height} + {row.amount} + {row.bridgeFee} + {row.networkFee} + {row.eventId.slice(0, 8)} + {row.WIDs.split(',').length} + + {row.spendBlock ? 'Completed' : 'Incomplete'} + ); };