fix numeric resolution panel
This commit is contained in:
parent
281f245fdc
commit
90c08709e2
|
@ -8,7 +8,6 @@ import { Spacer } from './layout/spacer'
|
||||||
import { ResolveConfirmationButton } from './confirmation-button'
|
import { ResolveConfirmationButton } from './confirmation-button'
|
||||||
import { resolveMarket } from 'web/lib/firebase/api-call'
|
import { resolveMarket } from 'web/lib/firebase/api-call'
|
||||||
import { NumericContract } from 'common/contract'
|
import { NumericContract } from 'common/contract'
|
||||||
import { getMappedBucket } from 'common/calculate-dpm'
|
|
||||||
import { BucketInput } from './bucket-input'
|
import { BucketInput } from './bucket-input'
|
||||||
|
|
||||||
export function NumericResolutionPanel(props: {
|
export function NumericResolutionPanel(props: {
|
||||||
|
@ -32,18 +31,13 @@ export function NumericResolutionPanel(props: {
|
||||||
const [error, setError] = useState<string | undefined>(undefined)
|
const [error, setError] = useState<string | undefined>(undefined)
|
||||||
|
|
||||||
const resolve = async () => {
|
const resolve = async () => {
|
||||||
if (!outcome) return
|
const finalOutcome = outcomeMode === 'NUMBER' ? outcome : 'CANCEL'
|
||||||
|
if (finalOutcome === undefined) return
|
||||||
let outcomeChoice = outcome
|
|
||||||
if (outcome !== 'CANCEL') {
|
|
||||||
const bucket = getMappedBucket(+outcome, contract)
|
|
||||||
outcomeChoice = `${bucket}`
|
|
||||||
}
|
|
||||||
|
|
||||||
setIsSubmitting(true)
|
setIsSubmitting(true)
|
||||||
|
|
||||||
const result = await resolveMarket({
|
const result = await resolveMarket({
|
||||||
outcome: outcomeChoice,
|
outcome: finalOutcome,
|
||||||
contractId: contract.id,
|
contractId: contract.id,
|
||||||
}).then((r) => r.data)
|
}).then((r) => r.data)
|
||||||
|
|
||||||
|
@ -56,9 +50,9 @@ export function NumericResolutionPanel(props: {
|
||||||
}
|
}
|
||||||
|
|
||||||
const submitButtonClass =
|
const submitButtonClass =
|
||||||
outcome === 'CANCEL'
|
outcomeMode === 'CANCEL'
|
||||||
? 'bg-yellow-400 hover:bg-yellow-500'
|
? 'bg-yellow-400 hover:bg-yellow-500'
|
||||||
: outcome
|
: outcome !== undefined
|
||||||
? 'btn-primary'
|
? 'btn-primary'
|
||||||
: 'btn-disabled'
|
: 'btn-disabled'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user