move ROE into PnL tooltip

This commit is contained in:
Lou-Kamades 2023-08-09 22:29:17 -05:00
parent a67af5bf32
commit ac9ff9f08f
No known key found for this signature in database
GPG Key ID: 87A166E4D7C01F30
8 changed files with 24 additions and 34 deletions

View File

@ -1,16 +1,19 @@
import { useTranslation } from 'next-i18next'
import { formatCurrencyValue } from 'utils/numbers'
import FormatNumericValue from './FormatNumericValue'
const PnlTooltipContent = ({
unrealizedPnl,
realizedPnl,
totalPnl,
unsettledPnl,
roe,
}: {
unrealizedPnl: number
realizedPnl: number
totalPnl: number
unsettledPnl: number
roe: number
}) => {
const { t } = useTranslation(['common', 'trade'])
return (
@ -42,6 +45,13 @@ const PnlTooltipContent = ({
{formatCurrencyValue(totalPnl, 2)}
</span>
</div>
<div className="flex justify-between">
<p className="mr-3">{t('trade:return-on-equity')}</p>
<span className="font-mono text-th-fgd-2">
<FormatNumericValue classNames="text-xs" value={roe} decimals={2} />
%{' '}
</span>
</div>
</div>
<a
href="https://docs.mango.markets/mango-markets/settle-pnl"

View File

@ -125,6 +125,7 @@ const PerpPositionsStatsTable = ({
realizedPnl={realizedPnl}
totalPnl={totalPnl}
unsettledPnl={unsettledPnl}
roe={roe}
/>
}
delay={100}
@ -315,6 +316,7 @@ const PerpPositionsStatsTable = ({
realizedPnl={realizedPnl}
totalPnl={totalPnl}
unsettledPnl={unsettledPnl}
roe={roe}
/>
}
delay={100}

View File

@ -265,6 +265,7 @@ const PerpPositions = () => {
realizedPnl={realizedPnl}
totalPnl={totalPnl}
unsettledPnl={unsettledPnl}
roe={roe}
/>
}
delay={100}
@ -283,19 +284,6 @@ const PerpPositions = () => {
/>
</span>
</Tooltip>
<span
className={roe >= 0 ? 'text-th-up' : 'text-th-down'}
>
<FormatNumericValue
classNames="text-xs"
value={roe}
decimals={2}
/>
%{' '}
<span className="font-body text-xs text-th-fgd-3">
(ROE)
</span>
</span>
</div>
</Td>
{!isUnownedAccount ? (
@ -343,7 +331,7 @@ const PerpPositions = () => {
</Td>
<Td className="text-right font-mono">
<div className="flex justify-end items-center">
<span className="font-body mr-3 text-md text-th-fgd-3">
<span className="font-body mr-4 text-md text-th-fgd-3">
Total:
</span>
<Tooltip
@ -353,6 +341,7 @@ const PerpPositions = () => {
realizedPnl={totalPnlStats.realized}
totalPnl={totalPnlStats.total}
unsettledPnl={totalPnlStats.unsettled}
roe={totalPnlStats.roe}
/>
}
delay={100}
@ -376,25 +365,8 @@ const PerpPositions = () => {
</Td>
{!isUnownedAccount ? (
<Td className="text-right font-mono">
{/* <div className="flex justify-start items-center">
<span
className={
totalPnlStats.roe >= 0
? 'text-th-up'
: 'text-th-down'
}
>
<FormatNumericValue
classNames="text-xs"
value={totalPnlStats.roe}
decimals={2}
/>
%{' '}
<span className="font-body text-xs text-th-fgd-3">
(ROE)
</span>
</span>
</div> */}
{' '}
<></>
</Td>
) : null}
</tr>
@ -604,6 +576,7 @@ const PerpPositions = () => {
realizedPnl={realizedPnl}
totalPnl={totalPnl}
unsettledPnl={unsettledPnl}
roe={roe}
/>
}
delay={100}
@ -702,7 +675,7 @@ const PerpPositions = () => {
Total ROE:
</span>
<span
className={`font-mono mr-2 ${
className={`font-mono mr-1.5 ${
totalPnlStats.roe >= 0
? 'text-th-up'
: 'text-th-down'

View File

@ -72,6 +72,7 @@
"realized-pnl": "Realized PnL",
"reduce": "Reduce",
"reduce-only": "Reduce Only",
"return-on-equity": "Return on Equity",
"sells": "Sells",
"settle-funds": "Settle Funds",
"settle-funds-error": "Failed to settle funds",

View File

@ -72,6 +72,7 @@
"realized-pnl": "Realized PnL",
"reduce": "Reduce",
"reduce-only": "Reduce Only",
"return-on-equity": "Return on Equity",
"sells": "Sells",
"settle-funds": "Settle Funds",
"settle-funds-error": "Failed to settle funds",

View File

@ -72,6 +72,7 @@
"realized-pnl": "Realized PnL",
"reduce": "Reduce",
"reduce-only": "Reduce Only",
"return-on-equity": "Return on Equity",
"sells": "Sells",
"settle-funds": "Settle Funds",
"settle-funds-error": "Failed to settle funds",

View File

@ -71,6 +71,7 @@
"quote": "计价",
"reduce": "Reduce",
"reduce-only": "限减少",
"return-on-equity": "Return on Equity",
"sells": "卖单",
"settle-funds": "借清资金",
"settle-funds-error": "借清出错",

View File

@ -72,6 +72,7 @@
"realized-pnl": "已實現的盈虧",
"reduce": "Reduce",
"reduce-only": "限減少",
"return-on-equity": "Return on Equity",
"sells": "賣單",
"settle-funds": "借清資金",
"settle-funds-error": "借清出錯",