diff --git a/components/BalancesTable.tsx b/components/BalancesTable.tsx index 01ad7b07..1320f4cd 100644 --- a/components/BalancesTable.tsx +++ b/components/BalancesTable.tsx @@ -127,7 +127,7 @@ const BalancesTable = ({ showZeroBalances = false }) => { const unsettledBalances = balances.filter((bal) => bal.unsettled > 0) return ( -
+
{unsettledBalances.length > 0 ? (
@@ -167,7 +167,7 @@ const BalancesTable = ({ showZeroBalances = false }) => { })}
) : null} -
+
{items.length > 0 ? ( !isMobile ? ( @@ -421,19 +421,13 @@ const BalancesTable = ({ showZeroBalances = false }) => { ) : ( <> -
{t('asset')}
-
- {t('net-balance')} -
- - } + colOneHeader={t('asset')} + colTwoHeader={t('net-balance')} /> {items.map((balance, index) => ( +
{ {balance.symbol}
-
+
{balance.net.toFixed()}
@@ -454,62 +448,68 @@ const BalancesTable = ({ showZeroBalances = false }) => { index={index} panelTemplate={ <> -
-
- {t('deposits')} +
+
+
+ {t('deposits')} +
+ {balance.deposits.toFixed()}
- {balance.deposits.toFixed()} -
-
-
- {t('borrows')} +
+
+ {t('borrows')} +
+ {balance.borrows.toFixed()}
- {balance.borrows.toFixed()} -
-
-
- {t('in-orders')} +
+
+ {t('in-orders')} +
+ {balance.orders.toFixed()}
- {balance.orders.toFixed()} -
-
-
- {t('unsettled')} +
+
+ {t('unsettled')} +
+ {balance.unsettled.toFixed()}
- {balance.unsettled.toFixed()} -
-
-
- {t('value')} +
+
+ {t('value')} +
+ {formatUsdValue(balance.value.toNumber())}
- {formatUsdValue(balance.value.toNumber())} -
-
-
- {t('rates')} +
+
+ {t('rates')} +
+ + {balance.depositRate.toFixed(2)}% + + / + + {balance.borrowRate.toFixed(2)}% +
- - {balance.depositRate.toFixed(2)}% - - / - - {balance.borrowRate.toFixed(2)}% -
- - +
+ + +
} /> diff --git a/components/PerpPositionsTable.tsx b/components/PerpPositionsTable.tsx index c7c5a580..dccd28bb 100644 --- a/components/PerpPositionsTable.tsx +++ b/components/PerpPositionsTable.tsx @@ -9,7 +9,6 @@ import { breakpoints } from './TradePageGrid' import { Table, Td, Th, TrBody, TrHead } from './TableElements' import { formatUsdValue } from '../utils' import Loading from './Loading' - import usePerpPositions from '../hooks/usePerpPositions' import MarketCloseModal from './MarketCloseModal' import { ExpandableRow } from './TableElements' @@ -17,6 +16,7 @@ import PerpSideBadge from './PerpSideBadge' import PnlText from './PnlText' import { settlePnl } from './MarketPosition' import { useTranslation } from 'next-i18next' +import MobileTableHeader from './mobile/MobileTableHeader' const PositionsTable = () => { const { t } = useTranslation('common') @@ -211,93 +211,93 @@ const PositionsTable = () => { ) : ( - openPositions.map( - ( - { - marketConfig, - basePosition, - notionalSize, - avgEntryPrice, - breakEvenPrice, - unrealizedPnl, - }, - index - ) => { - return ( - -
-
- -
-
- {marketConfig.name} -
-
- 0 - ? 'text-th-green' - : 'text-th-red' - }`} - > - {basePosition > 0 - ? t('long').toUpperCase() - : t('short').toUpperCase()} - - {Math.abs(basePosition)} + <> + + {openPositions.map( + ( + { + marketConfig, + basePosition, + notionalSize, + avgEntryPrice, + breakEvenPrice, + unrealizedPnl, + }, + index + ) => { + return ( + +
+
+ +
+
+ {marketConfig.name} +
+
+ 0 + ? 'text-th-green' + : 'text-th-red' + }`} + > + {basePosition > 0 + ? t('long').toUpperCase() + : t('short').toUpperCase()} + + {Math.abs(basePosition)} +
+
- -
- - } - key={`${index}`} - index={index} - panelTemplate={ - <> -
-
- {t('average-entry')} + + } + key={`${index}`} + index={index} + panelTemplate={ +
+
+
+ {t('average-entry')} +
+ {avgEntryPrice + ? formatUsdValue(avgEntryPrice) + : '--'}
- {avgEntryPrice - ? formatUsdValue(avgEntryPrice) - : '--'} -
-
-
- {t('notional-size')} +
+
+ {t('notional-size')} +
+ {formatUsdValue(notionalSize)}
- {formatUsdValue(notionalSize)} -
-
-
- {t('break-even')} +
+
+ {t('break-even')} +
+ {breakEvenPrice + ? formatUsdValue(breakEvenPrice) + : '--'}
- {breakEvenPrice - ? formatUsdValue(breakEvenPrice) - : '--'}
-
-
- {t('unrealized-pnl')} -
- -
- - } - /> - ) - } - ) + } + /> + ) + } + )} + ) ) : (
+
{t('recent-trades')}
} diff --git a/components/TableElements.tsx b/components/TableElements.tsx index 67e82d6b..c6b47890 100644 --- a/components/TableElements.tsx +++ b/components/TableElements.tsx @@ -55,7 +55,7 @@ export const ExpandableRow = ({ -
- {buttonTemplate} -
- -
+ {buttonTemplate} +
+
-
- {panelTemplate} -
+
{panelTemplate}
)} @@ -106,12 +102,10 @@ export const Row = ({ children, index }: RowProps) => { return (
-
{children}
+ {children}
) } diff --git a/components/TopBar.tsx b/components/TopBar.tsx index 1e855b14..04c08fe6 100644 --- a/components/TopBar.tsx +++ b/components/TopBar.tsx @@ -17,7 +17,6 @@ import Settings from './Settings' const TopBar = () => { const { t } = useTranslation('common') const mangoAccount = useMangoStore((s) => s.selectedMangoAccount.current) - const connected = useMangoStore((s) => s.wallet.connected) const [showAccountsModal, setShowAccountsModal] = useState(false) const [defaultMarket] = useLocalStorageState( DEFAULT_MARKET_KEY, @@ -31,7 +30,7 @@ const TopBar = () => { return ( <>