From 4c93da3cc072a70cf070c01c7f352fb8f663239e Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Fri, 20 May 2022 14:00:22 -0400 Subject: [PATCH] Use a blue bar for Numeric types --- web/components/contract/contract-card.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/web/components/contract/contract-card.tsx b/web/components/contract/contract-card.tsx index 5e054255..19f0842a 100644 --- a/web/components/contract/contract-card.tsx +++ b/web/components/contract/contract-card.tsx @@ -38,9 +38,17 @@ function getProb(contract: Contract) { ? getBinaryProb(contract) : outcomeType === 'FREE_RESPONSE' ? getOutcomeProbability(contract, getTopAnswer(contract)?.id || '') + : outcomeType === 'NUMERIC' + ? getNumericScale(contract as NumericContract) : 1 // Should not happen } +function getNumericScale(contract: NumericContract) { + const { min, max } = contract + const ev = getExpectedValue(contract) + return (ev - min) / (max - min) +} + function getColor(contract: Contract) { const { resolution } = contract if (resolution) { @@ -51,6 +59,9 @@ function getColor(contract: Contract) { 'primary' ) } + if (contract.outcomeType === 'NUMERIC') { + return 'blue-400' + } const marketClosed = (contract.closeTime || Infinity) < Date.now() return marketClosed