- {formatMoney(pnl)} (
{totalReturn})
+
Invested
+
+ {formatMoney(currentBetsValue)}{' '}
+
-
Currently invested
-
{formatMoney(currentInvestment)}
+
Balance
+
+ {formatMoney(user.balance)}{' '}
+
-
Current market value
-
{formatMoney(currentBetsValue)}
+
Total portfolio
+
+ {formatMoney(totalPortfolio)}{' '}
+
+
@@ -282,21 +283,15 @@ export function MyBetsSummary(props: {
const currentValue = resolution ? betsPayout : marketWinnings
const pnl = currentValue - betsTotal
- const totalReturn =
- betsTotal === 0
- ? '0%'
- : (pnl > 0 ? '+' : '') + ((pnl / betsTotal) * 100).toFixed() + '%'
+ const profit = (pnl / betsTotal) * 100
- const color = pnl === 0 ? '' : pnl > 0 ? 'text-green-500' : 'text-red-500'
-
- const mktCol = (
+ const valueCol = (
-
- Market value
+
+ {formatMoney(currentValue)}
-
- {formatMoney(marketWinnings)} (
-
{totalReturn})
+
)
@@ -305,7 +300,7 @@ export function MyBetsSummary(props: {
Payout
- {formatMoney(betsPayout)} (
{totalReturn})
+ {formatMoney(betsPayout)}
)
@@ -319,7 +314,7 @@ export function MyBetsSummary(props: {
)}
>
{onlyMKT ? (
-
{resolution ? payoutCol : mktCol}
+
{valueCol}
) : (
@@ -496,3 +491,23 @@ function SellButton(props: { contract: Contract; bet: Bet }) {
)
}
+
+function ProfitBadge(props: { profitPercent: number }) {
+ const { profitPercent } = props
+ if (!profitPercent) return null
+ const colors =
+ profitPercent > 0
+ ? 'bg-green-100 text-green-800'
+ : 'bg-red-100 text-red-800'
+
+ return (
+
+ {(profitPercent > 0 ? '+' : '') + profitPercent.toFixed(1) + '%'}
+
+ )
+}