expose pnl on mobile table row

This commit is contained in:
saml33 2021-09-28 23:15:36 +10:00
parent 0f6d39043f
commit 229d9a8fbf
2 changed files with 35 additions and 20 deletions

View File

@ -375,8 +375,8 @@ const BalancesTable = ({ showZeroBalances = false }) => {
{items.map((balance, index) => (
<ExpandableRow
buttonTemplate={
<>
<div className="col-span-7 flex items-center text-fgd-1">
<div className="col-span-11 flex items-center justify-between text-fgd-1">
<div className="flex items-center text-fgd-1">
<img
alt=""
width="20"
@ -387,10 +387,10 @@ const BalancesTable = ({ showZeroBalances = false }) => {
{balance.symbol}
</div>
<div className="col-span-4 text-fgd-1 text-right">
<div className="mr-1.5 text-fgd-1 text-right">
{balance.net.toFixed()}
</div>
</>
</div>
}
key={`${balance.symbol}${index}`}
index={index}

View File

@ -283,7 +283,7 @@ const PositionsTable = () => {
<ExpandableRow
buttonTemplate={
<>
<div className="col-span-11 flex items-center text-fgd-1">
<div className="col-span-11 flex items-center justify-between text-fgd-1">
<div className="flex items-center">
<img
alt=""
@ -322,15 +322,21 @@ const PositionsTable = () => {
)
)
: 0
} at ${getAvgEntryPrice(
mangoAccount,
perpAccount,
perpMarket,
perpTradeHistory
)}`}
}`}
</div>
</div>
</div>
{pnl !== null ? (
<span
className={`mr-1.5 ${
pnl > 0 ? 'text-th-green' : 'text-th-red'
}`}
>
{usdFormatter(pnl)}
</span>
) : (
'--'
)}
</div>
</>
}
@ -338,6 +344,17 @@ const PositionsTable = () => {
index={index}
panelTemplate={
<>
<div className="col-span-1 text-left">
<div className="pb-0.5 text-th-fgd-3 text-xs">
Ave Entry Price
</div>
{getAvgEntryPrice(
mangoAccount,
perpAccount,
perpMarket,
perpTradeHistory
)}
</div>
<div className="col-span-1 text-left">
<div className="pb-0.5 text-th-fgd-3 text-xs">
Notional Size
@ -369,15 +386,13 @@ const PositionsTable = () => {
PnL
</div>
{pnl !== null ? (
pnl > 0 ? (
<span className="text-th-green">
{usdFormatter(pnl)}
</span>
) : (
<span className="text-th-red">
{usdFormatter(pnl)}
</span>
)
<span
className={
pnl > 0 ? 'text-th-green' : 'text-th-red'
}
>
{usdFormatter(pnl)}
</span>
) : (
'--'
)}