From ef07bf6d82622444284e7c2d8106dcbbc4ebb71a Mon Sep 17 00:00:00 2001 From: tyleroooo Date: Thu, 7 Nov 2024 17:03:39 -0500 Subject: [PATCH] fix: sync up table rendering across the app (#1264) --- package.json | 2 +- pnpm-lock.yaml | 34 ++++++++++++------------- src/pages/Profile.tsx | 22 +++++++++++----- src/pages/portfolio/Orders.tsx | 37 ++++++++++++++++++--------- src/pages/portfolio/Overview.tsx | 40 +++++++++++++++++++++-------- src/pages/portfolio/Portfolio.tsx | 32 ++++++++++++++++------- src/pages/portfolio/Positions.tsx | 42 ++++++++++++++++++++++--------- 7 files changed, 141 insertions(+), 68 deletions(-) diff --git a/package.json b/package.json index 3f5812a28..e581fc157 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "@cosmjs/stargate": "^0.32.1", "@cosmjs/tendermint-rpc": "^0.32.1", "@datadog/browser-logs": "^5.23.3", - "@dydxprotocol/v4-abacus": "1.13.16", + "@dydxprotocol/v4-abacus": "1.13.18", "@dydxprotocol/v4-client-js": "1.12.2", "@dydxprotocol/v4-localization": "^1.1.240", "@dydxprotocol/v4-proto": "^7.0.0-dev.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 10a470922..d15cbbb96 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -30,8 +30,8 @@ dependencies: specifier: ^5.23.3 version: 5.23.3 '@dydxprotocol/v4-abacus': - specifier: 1.13.16 - version: 1.13.16 + specifier: 1.13.18 + version: 1.13.18 '@dydxprotocol/v4-client-js': specifier: 1.12.2 version: 1.12.2 @@ -2637,8 +2637,8 @@ packages: - fp-ts dev: false - /@chain-registry/types@0.50.6: - resolution: {integrity: sha512-SJsf50OqOqvclEVHRBm7RNKEeQoZ6RANVl0J1ztEPWnRyW24pt4iyEn1IYWb+V7wE4pn0NduhKdJ5jwh6nuJUQ==} + /@chain-registry/types@0.50.7: + resolution: {integrity: sha512-TdxpjuuHH9fA3L0X4JDoySNPfnwGN20jausZBYPjjUhrY1XJYl0vQgy6enkasY0IiORKpWCgR9BY/Nn6IA02yQ==} dev: false /@coinbase/wallet-sdk@3.9.3: @@ -3284,8 +3284,8 @@ packages: '@datadog/browser-core': 5.23.3 dev: false - /@dydxprotocol/v4-abacus@1.13.16: - resolution: {integrity: sha512-XrZMjxKhxPEHa1WkU4HMueHpf2PydgRyCFhxf7yvn+HqFcbgaPNs+QNwBA24i771oNL8YylkI8FzJca0QCyYVQ==} + /@dydxprotocol/v4-abacus@1.13.18: + resolution: {integrity: sha512-EZdztcsjY4QO59wRcg6PbuBri5RRG+rtYHBw71WBNDO0uYBSx+afazwZ9BMyU0GQM9cOodX8aPHMYCBJzBEDBw==} dependencies: '@js-joda/core': 3.2.0 format-util: 1.0.5 @@ -4428,16 +4428,16 @@ packages: deprecated: Use @eslint/object-schema instead dev: true - /@initia/initia-registry-types@0.0.17: - resolution: {integrity: sha512-5zBYKH1cU8I5vGUBmRYqAIbvKSJRehUOvUvDy4ohtcz5G7GjNRWvo7x7aXgMSDw5hnxTcqBCaJxsp4i8EcPIxg==} + /@initia/initia-registry-types@0.0.21: + resolution: {integrity: sha512-bYo0umADPq/qWAXzgISiETtiKj38EInp+CZLcr82Y3YwY4YdmFQvpu1/Tf4HsFGIcHvin4JB2PR03NPpKvOkbg==} dependencies: zod: 3.23.8 dev: false - /@initia/initia-registry@0.1.16: - resolution: {integrity: sha512-zqVa+fOZXxX0AzsNqIHCYU2sWr0+JICkj5Xaq4vw4kVPSey3mveU8dUFfdCcmfH8CXSeQ34wx8v1OIwQ3Fld6A==} + /@initia/initia-registry@0.2.1: + resolution: {integrity: sha512-iCGGHy6gDsyJsdAEq7prxl3168POqZmUoIuWibz044oVTWHrfN97rjf5YJEq9XLwKrELkZISynqgEXhlwK7WOw==} dependencies: - '@initia/initia-registry-types': 0.0.17 + '@initia/initia-registry-types': 0.0.21 dev: false /@injectivelabs/core-proto-ts@0.0.21: @@ -9515,14 +9515,14 @@ packages: '@cosmjs/proto-signing': 0.32.4 '@cosmjs/stargate': 0.32.4 '@cosmjs/tendermint-rpc': 0.32.4 - '@initia/initia-registry': 0.1.16 + '@initia/initia-registry': 0.2.1 '@injectivelabs/core-proto-ts': 0.0.21 '@injectivelabs/sdk-ts': 1.14.5(@types/react@18.3.3)(react-dom@18.2.0)(react@18.2.0) '@keplr-wallet/unit': 0.12.121 '@solana/wallet-adapter-base': 0.9.23(@solana/web3.js@1.93.2) '@solana/web3.js': 1.93.2 axios: 1.6.7 - chain-registry: 1.69.24 + chain-registry: 1.69.25 cosmjs-types: 0.8.0 keccak256: 1.0.6 kujira.js: 0.9.162 @@ -14167,10 +14167,10 @@ packages: type-detect: 4.1.0 dev: true - /chain-registry@1.69.24: - resolution: {integrity: sha512-eT6taV/wkJASFUuzBnb8Rc6NQabMnSPzEF3hKGwD0zj2G9FqdifywfygwpkVUgdMhjMIYhbiP8rSDGAOUvf59A==} + /chain-registry@1.69.25: + resolution: {integrity: sha512-4e/UeGiGkbpaZ9i0b4d20CgLx5rJBiS7BL4L2zHfjj3+Z0y1cV3VFlHXHDKhExPUgiGyzKiuGIMirkpu4kDK9Q==} dependencies: - '@chain-registry/types': 0.50.6 + '@chain-registry/types': 0.50.7 dev: false /chalk@2.4.2: @@ -19583,7 +19583,7 @@ packages: '@ethersproject/bignumber': 5.7.0 '@keplr-wallet/types': 0.11.64 '@types/google-protobuf': 3.15.12 - chain-registry: 1.69.24 + chain-registry: 1.69.25 cosmjs-types: 0.8.0 long: 4.0.0 text-encoding: 0.7.0 diff --git a/src/pages/Profile.tsx b/src/pages/Profile.tsx index 3da5dd636..a763f72ab 100644 --- a/src/pages/Profile.tsx +++ b/src/pages/Profile.tsx @@ -38,6 +38,7 @@ import { useAppDispatch, useAppSelector } from '@/state/appTypes'; import { openDialog } from '@/state/dialogs'; import { isTruthy } from '@/lib/isTruthy'; +import { testFlags } from '@/lib/testFlags'; import { truncateAddress } from '@/lib/wallet'; import { GovernancePanel } from './token/GovernancePanel'; @@ -70,6 +71,7 @@ const Profile = () => { const { sourceAccount, dydxAddress } = useAccounts(); const { chainTokenImage, chainTokenLabel } = useTokenConfigs(); const { disableConnectButton } = useComplianceState(); + const { uiRefresh } = testFlags; const { data: ensName } = useEnsName({ address: @@ -259,12 +261,20 @@ const Profile = () => { hasSeparator > diff --git a/src/pages/portfolio/Orders.tsx b/src/pages/portfolio/Orders.tsx index 812d7436a..0621b44be 100644 --- a/src/pages/portfolio/Orders.tsx +++ b/src/pages/portfolio/Orders.tsx @@ -28,18 +28,31 @@ export const Orders = () => { columnKeys={ isTablet ? [OrdersTableColumnKey.StatusFill, OrdersTableColumnKey.PriceType] - : [ - OrdersTableColumnKey.Market, - OrdersTableColumnKey.Status, - OrdersTableColumnKey.Side, - OrdersTableColumnKey.AmountFill, - uiRefresh && OrdersTableColumnKey.OrderValue, - OrdersTableColumnKey.Price, - OrdersTableColumnKey.Trigger, - OrdersTableColumnKey.MarginType, - OrdersTableColumnKey.GoodTil, - !isAccountViewOnly && OrdersTableColumnKey.Actions, - ].filter(isTruthy) + : uiRefresh + ? [ + OrdersTableColumnKey.Market, + OrdersTableColumnKey.Status, + OrdersTableColumnKey.Side, + OrdersTableColumnKey.Amount, + OrdersTableColumnKey.Filled, + OrdersTableColumnKey.OrderValue, + OrdersTableColumnKey.Price, + OrdersTableColumnKey.Trigger, + OrdersTableColumnKey.MarginType, + OrdersTableColumnKey.GoodTil, + !isAccountViewOnly && OrdersTableColumnKey.Actions, + ].filter(isTruthy) + : [ + OrdersTableColumnKey.Market, + OrdersTableColumnKey.Status, + OrdersTableColumnKey.Side, + OrdersTableColumnKey.AmountFill, + OrdersTableColumnKey.Price, + OrdersTableColumnKey.Trigger, + OrdersTableColumnKey.MarginType, + OrdersTableColumnKey.GoodTil, + !isAccountViewOnly && OrdersTableColumnKey.Actions, + ].filter(isTruthy) } withOuterBorder={isNotTablet} /> diff --git a/src/pages/portfolio/Overview.tsx b/src/pages/portfolio/Overview.tsx index 48cbe30ab..9346e7e04 100644 --- a/src/pages/portfolio/Overview.tsx +++ b/src/pages/portfolio/Overview.tsx @@ -25,6 +25,7 @@ import { useAppSelector } from '@/state/appTypes'; import { getDismissedAffiliateBanner } from '@/state/dismissableSelectors'; import { isTruthy } from '@/lib/isTruthy'; +import { testFlags } from '@/lib/testFlags'; import { MaybeUnopenedIsolatedPositionsPanel } from '../trade/UnopenedIsolatedPositions'; import { AccountDetailsAndHistory } from './AccountDetailsAndHistory'; @@ -54,6 +55,7 @@ export const Overview = () => { const shouldRenderActions = useParameterizedSelector( calculateShouldRenderActionsInPositionsTable ); + const { uiRefresh } = testFlags; return (
@@ -94,17 +96,33 @@ export const Overview = () => { PositionsTableColumnKey.IndexEntry, PositionsTableColumnKey.PnL, ] - : [ - PositionsTableColumnKey.Market, - PositionsTableColumnKey.Size, - PositionsTableColumnKey.Margin, - PositionsTableColumnKey.UnrealizedPnl, - PositionsTableColumnKey.RealizedPnl, - PositionsTableColumnKey.AverageOpenAndClose, - PositionsTableColumnKey.LiquidationAndOraclePrice, - shouldRenderTriggers && PositionsTableColumnKey.Triggers, - shouldRenderActions && PositionsTableColumnKey.Actions, - ].filter(isTruthy) + : uiRefresh + ? [ + PositionsTableColumnKey.Market, + PositionsTableColumnKey.Leverage, + PositionsTableColumnKey.Type, + PositionsTableColumnKey.Size, + PositionsTableColumnKey.Value, + PositionsTableColumnKey.PnL, + PositionsTableColumnKey.Margin, + PositionsTableColumnKey.AverageOpen, + PositionsTableColumnKey.Oracle, + PositionsTableColumnKey.Liquidation, + PositionsTableColumnKey.NetFunding, + shouldRenderTriggers && PositionsTableColumnKey.Triggers, + shouldRenderActions && PositionsTableColumnKey.Actions, + ].filter(isTruthy) + : [ + PositionsTableColumnKey.Market, + PositionsTableColumnKey.Size, + PositionsTableColumnKey.Margin, + PositionsTableColumnKey.UnrealizedPnl, + PositionsTableColumnKey.RealizedPnl, + PositionsTableColumnKey.AverageOpenAndClose, + PositionsTableColumnKey.LiquidationAndOraclePrice, + shouldRenderTriggers && PositionsTableColumnKey.Triggers, + shouldRenderActions && PositionsTableColumnKey.Actions, + ].filter(isTruthy) } currentRoute={AppRoute.Portfolio} navigateToOrders={() => diff --git a/src/pages/portfolio/Portfolio.tsx b/src/pages/portfolio/Portfolio.tsx index 6b2c7bb87..727a6305e 100644 --- a/src/pages/portfolio/Portfolio.tsx +++ b/src/pages/portfolio/Portfolio.tsx @@ -33,6 +33,7 @@ import { useAppDispatch, useAppSelector } from '@/state/appTypes'; import { openDialog } from '@/state/dialogs'; import { shortenNumberForDisplay } from '@/lib/numbers'; +import { testFlags } from '@/lib/testFlags'; import { VaultTransactionsTable } from '../vaults/VaultTransactions'; import { PortfolioNavMobile } from './PortfolioNavMobile'; @@ -69,6 +70,7 @@ const PortfolioPage = () => { const usdcBalance = freeCollateral?.current ?? 0; useDocumentTitle(stringGetter({ key: STRING_KEYS.PORTFOLIO })); + const { uiRefresh } = testFlags; const routesComponent = ( }> @@ -92,15 +94,27 @@ const PortfolioPage = () => { FillsTableColumnKey.TypeAmount, FillsTableColumnKey.PriceFee, ] - : [ - FillsTableColumnKey.Time, - FillsTableColumnKey.Market, - FillsTableColumnKey.Side, - FillsTableColumnKey.AmountPrice, - FillsTableColumnKey.TotalFee, - FillsTableColumnKey.Type, - FillsTableColumnKey.Liquidity, - ] + : uiRefresh + ? [ + FillsTableColumnKey.Market, + FillsTableColumnKey.Time, + FillsTableColumnKey.Type, + FillsTableColumnKey.Side, + FillsTableColumnKey.AmountTag, + FillsTableColumnKey.Price, + FillsTableColumnKey.Total, + FillsTableColumnKey.Fee, + FillsTableColumnKey.Liquidity, + ] + : [ + FillsTableColumnKey.Time, + FillsTableColumnKey.Market, + FillsTableColumnKey.Side, + FillsTableColumnKey.AmountPrice, + FillsTableColumnKey.TotalFee, + FillsTableColumnKey.Type, + FillsTableColumnKey.Liquidity, + ] } withOuterBorder={isNotTablet} /> diff --git a/src/pages/portfolio/Positions.tsx b/src/pages/portfolio/Positions.tsx index 475e59586..f95cd722d 100644 --- a/src/pages/portfolio/Positions.tsx +++ b/src/pages/portfolio/Positions.tsx @@ -22,6 +22,7 @@ import { calculateShouldRenderActionsInPositionsTable } from '@/state/accountCal import { track } from '@/lib/analytics/analytics'; import { isTruthy } from '@/lib/isTruthy'; +import { testFlags } from '@/lib/testFlags'; import { MaybeUnopenedIsolatedPositionsPanel } from '../trade/UnopenedIsolatedPositions'; import { MaybeVaultPositionsPanel } from '../vaults/VaultPositions'; @@ -48,6 +49,7 @@ export const Positions = () => { state: { from: AppRoute.Portfolio }, }); }, [navigate]); + const { uiRefresh } = testFlags; return ( <> @@ -64,18 +66,34 @@ export const Positions = () => { PositionsTableColumnKey.IndexEntry, PositionsTableColumnKey.PnL, ] - : [ - PositionsTableColumnKey.Market, - PositionsTableColumnKey.Size, - PositionsTableColumnKey.Margin, - PositionsTableColumnKey.UnrealizedPnl, - PositionsTableColumnKey.RealizedPnl, - PositionsTableColumnKey.NetFunding, - PositionsTableColumnKey.AverageOpenAndClose, - PositionsTableColumnKey.LiquidationAndOraclePrice, - shouldRenderTriggers && PositionsTableColumnKey.Triggers, - shouldRenderActions && PositionsTableColumnKey.Actions, - ].filter(isTruthy) + : uiRefresh + ? [ + PositionsTableColumnKey.Market, + PositionsTableColumnKey.Leverage, + PositionsTableColumnKey.Type, + PositionsTableColumnKey.Size, + PositionsTableColumnKey.Value, + PositionsTableColumnKey.PnL, + PositionsTableColumnKey.Margin, + PositionsTableColumnKey.AverageOpen, + PositionsTableColumnKey.Oracle, + PositionsTableColumnKey.Liquidation, + PositionsTableColumnKey.NetFunding, + shouldRenderTriggers && PositionsTableColumnKey.Triggers, + shouldRenderActions && PositionsTableColumnKey.Actions, + ].filter(isTruthy) + : [ + PositionsTableColumnKey.Market, + PositionsTableColumnKey.Size, + PositionsTableColumnKey.Margin, + PositionsTableColumnKey.UnrealizedPnl, + PositionsTableColumnKey.RealizedPnl, + PositionsTableColumnKey.NetFunding, + PositionsTableColumnKey.AverageOpenAndClose, + PositionsTableColumnKey.LiquidationAndOraclePrice, + shouldRenderTriggers && PositionsTableColumnKey.Triggers, + shouldRenderActions && PositionsTableColumnKey.Actions, + ].filter(isTruthy) } currentRoute={`${AppRoute.Portfolio}/${PortfolioRoute.Positions}`} withOuterBorder={isNotTablet}