diff --git a/components/FeeDiscountsTable.tsx b/components/FeeDiscountsTable.tsx index afd5d09..9116760 100644 --- a/components/FeeDiscountsTable.tsx +++ b/components/FeeDiscountsTable.tsx @@ -5,6 +5,7 @@ import useMangoStore from '../stores/useMangoStore' import Button from './Button' import DepositSrmModal from './DepositSrmModal' import WithdrawSrmModal from './WithdrawSrmModal' +import { SRM_DECIMALS } from '@project-serum/serum/lib/token-instructions' const FeeDiscountsTable = () => { const [showDeposit, setShowDeposit] = useState(false) @@ -51,7 +52,11 @@ const FeeDiscountsTable = () => { >
Total SRM in Mango
-
{totalSrm}
+
+ {totalSrm.toLocaleString(undefined, { + maximumFractionDigits: SRM_DECIMALS, + })} +
Maker Fee
diff --git a/components/TradePageGrid.tsx b/components/TradePageGrid.tsx index c9ff3f5..7b78b8a 100644 --- a/components/TradePageGrid.tsx +++ b/components/TradePageGrid.tsx @@ -5,6 +5,7 @@ const TVChartContainer = dynamic( () => import('../components/TradingView/index'), { ssr: false } ) +import { useEffect, useState } from 'react' import FloatingElement from '../components/FloatingElement' import Orderbook from '../components/Orderbook' import MarginInfo from './MarginInfo' @@ -19,13 +20,13 @@ const ResponsiveGridLayout = WidthProvider(Responsive) const defaultLayouts = { xl: [ - { i: 'tvChart', x: 0, y: 0, w: 3, h: 30 }, - { i: 'orderbook', x: 3, y: 0, w: 1, h: 17 }, - { i: 'tradeForm', x: 4, y: 0, w: 1, h: 17 }, - { i: 'marginInfo', x: 4, y: 2, w: 1, h: 12 }, - { i: 'marketTrades', x: 3, y: 1, w: 1, h: 13 }, - { i: 'userInfo', x: 0, y: 2, w: 3, h: 17 }, - { i: 'balanceInfo', x: 4, y: 1, w: 1, h: 13 }, + { i: 'tvChart', x: 0, y: 0, w: 4, h: 30 }, + { i: 'orderbook', x: 4, y: 0, w: 2, h: 17 }, + { i: 'tradeForm', x: 6, y: 0, w: 2, h: 17 }, + { i: 'marketTrades', x: 4, y: 1, w: 2, h: 13 }, + { i: 'balanceInfo', x: 6, y: 1, w: 2, h: 13 }, + { i: 'userInfo', x: 0, y: 2, w: 6, h: 17 }, + { i: 'marginInfo', x: 6, y: 2, w: 2, h: 12 }, ], lg: [ { i: 'tvChart', x: 0, y: 0, w: 2, h: 24 }, @@ -51,12 +52,16 @@ const TradePageGrid = () => { } } + const [mounted, setMounted] = useState(false) + useEffect(() => setMounted(true), []) + if (!mounted) return null + return ( void>( (newState) => { + if (!localStorageListeners[key]) { + localStorageListeners[key] = [] + } const changed = state !== newState if (!changed) { return diff --git a/pages/stats.tsx b/pages/stats.tsx index 5241db3..d83b1c4 100644 --- a/pages/stats.tsx +++ b/pages/stats.tsx @@ -9,6 +9,7 @@ import FloatingElement from '../components/FloatingElement' import useConnection from '../hooks/useConnection' import TopBar from '../components/TopBar' import Select from '../components/Select' +import { formatBalanceDisplay } from '../utils/index' const DECIMALS = { BTC: 4, @@ -232,10 +233,20 @@ export default function StatsPage() { - {stat.totalDeposits.toFixed(DECIMALS[stat.symbol])} + {formatBalanceDisplay( + stat.totalDeposits, + DECIMALS[stat.symbol] + ).toLocaleString(undefined, { + maximumFractionDigits: DECIMALS[stat.symbol], + })} - {stat.totalBorrows.toFixed(DECIMALS[stat.symbol])} + {formatBalanceDisplay( + stat.totalBorrows, + DECIMALS[stat.symbol] + ).toLocaleString(undefined, { + maximumFractionDigits: DECIMALS[stat.symbol], + })} {stat.depositInterest.toFixed(2)}%