Gray scale position and profit

This commit is contained in:
James Grugett 2022-10-11 16:29:14 -05:00
parent 220d0841bd
commit 946d74489f
2 changed files with 14 additions and 9 deletions

View File

@ -21,7 +21,6 @@ import {
import { import {
AnswerLabel, AnswerLabel,
BinaryContractOutcomeLabel, BinaryContractOutcomeLabel,
BinaryOutcomeLabel,
CancelLabel, CancelLabel,
FreeResponseOutcomeLabel, FreeResponseOutcomeLabel,
} from '../outcome-label' } from '../outcome-label'
@ -430,17 +429,16 @@ export function ContractCardProbChange(props: {
'items-center justify-between gap-4 pl-6 pr-4 pb-2 text-sm' 'items-center justify-between gap-4 pl-6 pr-4 pb-2 text-sm'
)} )}
> >
<Row className="gap-1"> <Row className="gap-1 text-gray-700">
<div className="text-gray-500">Position</div> <div className="text-gray-500">Position</div>
{formatMoney(metrics.payout)} {formatMoney(metrics.payout)} {outcome}
<BinaryOutcomeLabel outcome={outcome} />
</Row> </Row>
{dayMetrics && ( {dayMetrics && (
<> <>
<Row className="items-center"> <Row className="items-center">
<div className="mr-1 text-gray-500">Daily profit</div> <div className="mr-1 text-gray-500">Daily profit</div>
<ProfitBadgeMana amount={dayMetrics.profit} /> <ProfitBadgeMana amount={dayMetrics.profit} gray />
</Row> </Row>
</> </>
)} )}

View File

@ -28,10 +28,17 @@ export function ProfitBadge(props: {
) )
} }
export function ProfitBadgeMana(props: { amount: number; className?: string }) { export function ProfitBadgeMana(props: {
const { amount, className } = props amount: number
const colors = gray?: boolean
amount > 0 ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800' className?: string
}) {
const { amount, gray, className } = props
const colors = gray
? 'bg-gray-100 text-gray-700'
: amount > 0
? 'bg-gray-100 text-green-800'
: 'bg-gray-100 text-red-800'
const formatted = const formatted =
ENV_CONFIG.moneyMoniker + (amount > 0 ? '+' : '') + amount.toFixed(0) ENV_CONFIG.moneyMoniker + (amount > 0 ? '+' : '') + amount.toFixed(0)