Use a blue bar for Numeric types

This commit is contained in:
Austin Chen 2022-05-20 14:00:22 -04:00
parent 5d96fdafd6
commit 4c93da3cc0

View File

@ -38,9 +38,17 @@ function getProb(contract: Contract) {
? getBinaryProb(contract) ? getBinaryProb(contract)
: outcomeType === 'FREE_RESPONSE' : outcomeType === 'FREE_RESPONSE'
? getOutcomeProbability(contract, getTopAnswer(contract)?.id || '') ? getOutcomeProbability(contract, getTopAnswer(contract)?.id || '')
: outcomeType === 'NUMERIC'
? getNumericScale(contract as NumericContract)
: 1 // Should not happen : 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) { function getColor(contract: Contract) {
const { resolution } = contract const { resolution } = contract
if (resolution) { if (resolution) {
@ -51,6 +59,9 @@ function getColor(contract: Contract) {
'primary' 'primary'
) )
} }
if (contract.outcomeType === 'NUMERIC') {
return 'blue-400'
}
const marketClosed = (contract.closeTime || Infinity) < Date.now() const marketClosed = (contract.closeTime || Infinity) < Date.now()
return marketClosed return marketClosed