From 2554545c7e83481fa9be65105f6f1c650e4fbe0e Mon Sep 17 00:00:00 2001 From: Yashvardhan Jagnani Date: Fri, 10 May 2024 20:04:58 +0530 Subject: [PATCH] feat(tables): ts --- src/components/Atoms/Address/Address.tsx | 7 +- .../AddressActivityListView.tsx | 64 ++-- .../TokenBalancesListView.tsx | 355 +++++------------- .../TokenTransfersListView.tsx | 177 +++++---- .../XYKOverviewTransactionsListView.tsx | 73 ++-- .../XYK/XYKPoolListView/XYKPoolListView.tsx | 337 +++++------------ .../XYKPoolTransactionsListView.tsx | 49 ++- .../XYK/XYKTokenListView/XYKTokenListView.tsx | 352 +++++------------ .../XYKTokenPoolListView.tsx | 342 +++++------------ .../XYKTokenTransactionsListView.tsx | 49 ++- .../XYKWalletPoolListView.tsx | 235 +++--------- .../XYKWalletPositionsListView.tsx | 39 +- .../XYKWalletTransactionsListView.tsx | 43 +-- src/components/Shared/IconWrapper.tsx | 4 +- src/components/Shared/TableHeaderSorting.tsx | 12 +- src/components/Shared/TableList.tsx | 10 +- src/components/Shared/Transactions.tsx | 28 +- src/utils/functions/timestamp-parser.ts | 8 + src/utils/types/shared.types.ts | 8 +- 19 files changed, 667 insertions(+), 1525 deletions(-) diff --git a/src/components/Atoms/Address/Address.tsx b/src/components/Atoms/Address/Address.tsx index cf3c88e2..a629111f 100644 --- a/src/components/Atoms/Address/Address.tsx +++ b/src/components/Atoms/Address/Address.tsx @@ -22,8 +22,9 @@ export const Address: React.FC = ({ }; return ( -
-

{truncate(address)}

+

+ {truncate(address)} + {show_copy_icon ? (

+

); }; diff --git a/src/components/Organisms/AddressActivityListView/AddressActivityListView.tsx b/src/components/Organisms/AddressActivityListView/AddressActivityListView.tsx index ace766c8..500f39cb 100644 --- a/src/components/Organisms/AddressActivityListView/AddressActivityListView.tsx +++ b/src/components/Organisms/AddressActivityListView/AddressActivityListView.tsx @@ -46,64 +46,54 @@ export const AddressActivityListView: React.FC< const columns: ColumnDef[] = [ { accessorKey: "label", + id: "label", header: ({ column }) => ( - align="left" - header_name={"Name"} + header="Chain Name" column={column} /> ), - cell: ({ row }) => { - return ( -
- - {row.getValue("label")} -
- ); - }, + cell: ({ row }) => ( +
+ + {row.getValue("label")} +
+ ), }, { accessorKey: "last_seen_at", + id: "last_seen_at", header: ({ column }) => ( - align="left" - header_name={"Last Active"} + header="Last Active" column={column} /> ), - cell: ({ row }) => { - const t = (row.getValue("last_seen_at") as string).toString(); - - return
{timestampParser(t, "relative")}
; - }, + cell: ({ row }) => + timestampParser(row.getValue("last_seen_at"), "relative"), }, { accessorKey: "is_testnet", + id: "is_testnet", header: ({ column }) => ( - align="center" - header_name={"Mainnet"} + header="Mainnet" column={column} /> ), - - cell: ({ row }) => { - const t = row.getValue("is_testnet"); - - return ( -
- {t ? ( - "" - ) : ( - - )} -
- ); - }, + cell: ({ row }) => + !row.getValue("is_testnet") ? ( + + ) : ( + <> + ), }, ]; diff --git a/src/components/Organisms/TokenBalancesListView/TokenBalancesListView.tsx b/src/components/Organisms/TokenBalancesListView/TokenBalancesListView.tsx index 208bf8f9..16b66fd4 100644 --- a/src/components/Organisms/TokenBalancesListView/TokenBalancesListView.tsx +++ b/src/components/Organisms/TokenBalancesListView/TokenBalancesListView.tsx @@ -46,18 +46,6 @@ export const TokenBalancesListView: React.FC = ({ const [errorMessage, setErrorMessage] = useState(null); const [filterResult, setFilterResult] = useState>(None); - const [windowWidth, setWindowWidth] = useState(0); - - useEffect(() => { - setWindowWidth(window.innerWidth); - const handleResize = () => { - setWindowWidth(window.innerWidth); - }; - window.addEventListener("resize", handleResize); - return () => { - window.removeEventListener("resize", handleResize); - }; - }, []); useEffect(() => { (async () => { @@ -115,35 +103,28 @@ export const TokenBalancesListView: React.FC = ({ id: "contract_name", accessorKey: "contract_name", header: ({ column }) => ( -
- -
+ + align="left" + header={"Token"} + column={column} + /> ), cell: ({ row }) => { const chain: ChainItem | null = chains?.find((o) => o.name === row.original.chain) ?? null; const chainColor = chain?.color_theme.hex; - const chain_label = (chain?.label ? chain.label : "").replace( - " Mainnet", - "" - ); - const protocol_url = row.original.logo_urls.protocol_logo_url; return ( -
+
- {chain_label} + {chain?.label.replace(" Mainnet", "")}