diff --git a/packages/app/src/sections/dashboard/FuturesHistoryTable.tsx b/packages/app/src/sections/dashboard/FuturesHistoryTable.tsx index 08210434dd..3cdd08dab0 100644 --- a/packages/app/src/sections/dashboard/FuturesHistoryTable.tsx +++ b/packages/app/src/sections/dashboard/FuturesHistoryTable.tsx @@ -317,13 +317,15 @@ const FuturesHistoryTable: FC = () => { header: () =>
{t('dashboard.history.futures-history-table.pnl')}
, accessorKey: 'netPnl', cell: (cellProps) => { + const value = cellProps.getValue() + return conditionalRender( - cellProps.getValue(), - cellProps.getValue().eq(wei(0)) ? ( + value, + value.eq(wei(0)) ? ( -- ) : ( - - {formatDollars(cellProps.getValue(), { maxDecimals: 2 })} + + {formatDollars(value, { maxDecimals: 2 })} ) ) diff --git a/packages/app/src/sections/dashboard/FuturesMarketsTable.tsx b/packages/app/src/sections/dashboard/FuturesMarketsTable.tsx index b709d2bf7d..cff632f755 100644 --- a/packages/app/src/sections/dashboard/FuturesMarketsTable.tsx +++ b/packages/app/src/sections/dashboard/FuturesMarketsTable.tsx @@ -6,7 +6,6 @@ import { formatDollars, } from '@kwenta/sdk/utils' import { wei } from '@synthetixio/wei' -import { Row } from '@tanstack/react-table' import { useRouter } from 'next/router' import { useMemo } from 'react' import { useTranslation } from 'react-i18next' @@ -29,23 +28,12 @@ import { import { useAppSelector } from 'state/hooks' import { selectPreviousDayPrices, selectOffchainPricesInfo } from 'state/prices/selectors' import { getSynthDescription } from 'utils/futures' +import { weiSortingFn } from 'utils/table' type FuturesMarketsTableProps = { search?: string } -const weiSortingFn = - (key: keyof T) => - (rowA: Row, rowB: Row) => { - const valA = rowA.original[key] - const valB = rowB.original[key] - - const rowOne = valA ? wei(valA) : wei(0) - const rowTwo = valB ? wei(valB) : wei(0) - - return rowOne.toNumber() > rowTwo.toNumber() ? 1 : -1 - } - const sortBy = [{ id: 'dailyVolume', desc: true }] const FuturesMarketsTable: React.FC = ({ search }) => { diff --git a/packages/app/src/sections/leaderboard/Leaderboard.tsx b/packages/app/src/sections/leaderboard/Leaderboard.tsx index 39a644e1f1..fcea0d8e50 100644 --- a/packages/app/src/sections/leaderboard/Leaderboard.tsx +++ b/packages/app/src/sections/leaderboard/Leaderboard.tsx @@ -50,9 +50,6 @@ const Leaderboard: FC = ({ compact, mobile }) => { const leaderboardLoading = useAppSelector(selectLeaderboardLoading) const leaderboardData = useAppSelector(selectLeaderboard) - // TODO: Separate search from the general list, to improve performance. - // This currently refetches the whole list when we search. - useFetchAction(() => fetchLeaderboard(searchTerm), { dependencies: [searchTerm] }) const pinRow = useMemo(() => { diff --git a/packages/app/src/utils/table.ts b/packages/app/src/utils/table.ts new file mode 100644 index 0000000000..115f06cd23 --- /dev/null +++ b/packages/app/src/utils/table.ts @@ -0,0 +1,14 @@ +import { wei } from '@synthetixio/wei' +import { Row } from '@tanstack/react-table' + +export const weiSortingFn = + (key: keyof T) => + (rowA: Row, rowB: Row) => { + const valA = rowA.original[key] + const valB = rowB.original[key] + + const rowOne = valA ? wei(valA) : wei(0) + const rowTwo = valB ? wei(valB) : wei(0) + + return rowOne.toNumber() > rowTwo.toNumber() ? 1 : -1 + } diff --git a/packages/sdk/tsconfig.json b/packages/sdk/tsconfig.json index 6f1a9b7d60..b273cc4965 100644 --- a/packages/sdk/tsconfig.json +++ b/packages/sdk/tsconfig.json @@ -17,12 +17,12 @@ "useUnknownInCatchVariables": false, }, "watchOptions": { - "watchFile": "useFsEvents", - "watchDirectory": "useFsEvents", - "fallbackPolling": "dynamicPriority", - "synchronousWatchDirectory": true, - "excludeDirectories": ["**/node_modules", "dist"], - }, + "watchFile": "useFsEvents", + "watchDirectory": "useFsEvents", + "fallbackPolling": "dynamicPriority", + "synchronousWatchDirectory": true, + "excludeDirectories": ["**/node_modules", "dist"], + }, "include": ["src", "src/**/**.json"], "exclude": ["node_modules"], }