From 15d8bcbc65a98aff06201a1c047c2f20698dba6c Mon Sep 17 00:00:00 2001 From: PhilReact Date: Tue, 24 Dec 2024 01:32:14 +0200 Subject: [PATCH] fixes --- src/components/Grids/TradeOffers.tsx | 70 ++++++++++++++-------------- src/components/header/Header.tsx | 2 +- 2 files changed, 37 insertions(+), 35 deletions(-) diff --git a/src/components/Grids/TradeOffers.tsx b/src/components/Grids/TradeOffers.tsx index bc00c6c..aba8d7d 100644 --- a/src/components/Grids/TradeOffers.tsx +++ b/src/components/Grids/TradeOffers.tsx @@ -109,41 +109,43 @@ export const TradeOffers: React.FC = ({foreignCoinBalance}:any) => { } } - const columnDefs: ColDef[] = [ - { - headerCheckboxSelection: true, // Adds a checkbox in the header for selecting all rows - checkboxSelection: true, // Adds checkboxes in each row for selection - headerName: "Select", // You can customize the header name - width: 50, // Adjust the width as needed - pinned: 'left', // Optional, to pin this column on the left - resizable: false, - }, - { headerName: "QORT AMOUNT", field: "qortAmount" , flex: 1, // Flex makes this column responsive - minWidth: 150, // Ensure it doesn't shrink too much - resizable: true }, - { headerName: `${getCoinLabel()}/QORT`, valueGetter: (params) => +params.data.foreignAmount / +params.data.qortAmount, sortable: true, sort: 'asc', flex: 1, // Flex makes this column responsive - minWidth: 150, // Ensure it doesn't shrink too much - resizable: true }, - { headerName: `Total ${getCoinLabel()} Value`, field: "foreignAmount", flex: 1, // Flex makes this column responsive - minWidth: 150, // Ensure it doesn't shrink too much - resizable: true }, - { headerName: "Seller", field: "qortalCreator", flex: 1, // Flex makes this column responsive - minWidth: 300, // Ensure it doesn't shrink too much - resizable: true, valueGetter: (params)=> { - if(params?.data?.qortalCreator){ - if(qortalNames[params?.data?.qortalCreator]){ - return qortalNames[params?.data?.qortalCreator] - } else if(qortalNames[params?.data?.qortalCreator] === undefined){ - getName(params?.data?.qortalCreator) - - return params?.data?.qortalCreator - } else { - return params?.data?.qortalCreator - + const columnDefs: ColDef[] = useMemo(()=> { + return [ + { + headerCheckboxSelection: true, // Adds a checkbox in the header for selecting all rows + checkboxSelection: true, // Adds checkboxes in each row for selection + headerName: "", // You can customize the header name + width: 50, // Adjust the width as needed + pinned: 'left', // Optional, to pin this column on the left + resizable: false, + }, + { headerName: "QORT AMOUNT", field: "qortAmount" , flex: 1, // Flex makes this column responsive + minWidth: 150, // Ensure it doesn't shrink too much + resizable: true }, + { headerName: `${getCoinLabel()}/QORT`, valueGetter: (params) => +params.data.foreignAmount / +params.data.qortAmount, sortable: true, sort: 'asc', flex: 1, // Flex makes this column responsive + minWidth: 150, // Ensure it doesn't shrink too much + resizable: true }, + { headerName: `Total ${getCoinLabel()} Value`, field: "foreignAmount", flex: 1, // Flex makes this column responsive + minWidth: 150, // Ensure it doesn't shrink too much + resizable: true }, + { headerName: "Seller", field: "qortalCreator", flex: 1, // Flex makes this column responsive + minWidth: 300, // Ensure it doesn't shrink too much + resizable: true, valueGetter: (params)=> { + if(params?.data?.qortalCreator){ + if(qortalNames[params?.data?.qortalCreator]){ + return qortalNames[params?.data?.qortalCreator] + } else if(qortalNames[params?.data?.qortalCreator] === undefined){ + getName(params?.data?.qortalCreator) + + return params?.data?.qortalCreator + } else { + return params?.data?.qortalCreator + + } } - } - } }, - ]; + } }, + ]; + },[qortalNames]) diff --git a/src/components/header/Header.tsx b/src/components/header/Header.tsx index 91e3e35..c94dc14 100644 --- a/src/components/header/Header.tsx +++ b/src/components/header/Header.tsx @@ -345,7 +345,7 @@ export const Header = ({ }} >