Switch summary stat from payout at current % to profit

This commit is contained in:
James Grugett 2022-04-13 17:57:46 -05:00
parent bfb708d477
commit a09af526a0

View File

@ -317,7 +317,7 @@ export function MyBetsSummary(props: {
const noWinnings = _.sumBy(excludeSales, (bet) => const noWinnings = _.sumBy(excludeSales, (bet) =>
calculatePayout(contract, bet, 'NO') calculatePayout(contract, bet, 'NO')
) )
const { invested, profitPercent, payout } = getContractBetMetrics( const { invested, profitPercent, payout, profit } = getContractBetMetrics(
contract, contract,
bets bets
) )
@ -343,7 +343,7 @@ export function MyBetsSummary(props: {
</Col> </Col>
) : ( ) : (
<> <>
{isBinary && ( {isBinary ? (
<> <>
<Col> <Col>
<div className="whitespace-nowrap text-sm text-gray-500"> <div className="whitespace-nowrap text-sm text-gray-500">
@ -362,24 +362,22 @@ export function MyBetsSummary(props: {
</div> </div>
</Col> </Col>
</> </>
) : (
<Col>
<div className="whitespace-nowrap text-sm text-gray-500">
Current value
</div>
<div className="whitespace-nowrap">{formatMoney(payout)}</div>
</Col>
)} )}
<Col>
<div className="whitespace-nowrap text-sm text-gray-500">
{isBinary ? (
<>
Payout at{' '}
<span className="text-blue-400">
{formatPercent(getProbability(contract))}
</span>
</>
) : (
<>Current payout</>
)}
</div>
<div className="whitespace-nowrap">{formatMoney(payout)}</div>
</Col>
</> </>
)} )}
<Col>
<div className="whitespace-nowrap text-sm text-gray-500">Profit</div>
<div className="whitespace-nowrap">
{formatMoney(profit)} <ProfitBadge profitPercent={profitPercent} />
</div>
</Col>
</Row> </Row>
</Row> </Row>
) )