diff --git a/web/components/contract/contract-card.tsx b/web/components/contract/contract-card.tsx
index f1da5956..1d287920 100644
--- a/web/components/contract/contract-card.tsx
+++ b/web/components/contract/contract-card.tsx
@@ -22,6 +22,7 @@ import { useState } from 'react'
import { getProbability } from '../../../common/calculate'
import { ContractInfoDialog } from './contract-info-dialog'
import { Bet } from '../../../common/bet'
+import { DPM, FreeResponse, FullContract } from '../../../common/contract'
export function ContractCard(props: {
contract: Contract
@@ -30,7 +31,7 @@ export function ContractCard(props: {
className?: string
}) {
const { contract, showHotVolume, showCloseTime, className } = props
- const { question } = contract
+ const { question, outcomeType } = contract
return (
@@ -51,20 +52,42 @@ export function ContractCard(props: {
/>
-
+
{question}
-
+
)
}
+function getAnswerResolutionText(
+ contract: FullContract,
+ resolution: string
+) {
+ const { answers } = contract
+ const chosen = answers?.find((answer) => answer.id === resolution)
+ if (chosen) {
+ return chosen.text.slice(0, 50)
+ }
+ return undefined
+}
+
export function ResolutionOrChance(props: {
contract: Contract
large?: boolean
@@ -86,18 +109,25 @@ export function ResolutionOrChance(props: {
const probColor = marketClosed ? 'text-gray-400' : 'text-primary'
- const resolutionText =
- {
- YES: 'YES',
- NO: 'NO',
- MKT: isBinary
- ? formatPercent(
- contract.resolutionProbability ?? getProbability(contract)
- )
- : 'MULTI',
- CANCEL: 'N/A',
- '': '',
- }[resolution || ''] ?? `#${resolution}`
+ const resolutionText = {
+ YES: 'YES',
+ NO: 'NO',
+ MKT: isBinary
+ ? formatPercent(
+ contract.resolutionProbability ?? getProbability(contract)
+ )
+ : 'MULTI',
+ CANCEL: 'N/A',
+ '': '',
+ }[resolution || '']
+
+ const answerText =
+ resolution &&
+ outcomeType === 'FREE_RESPONSE' &&
+ getAnswerResolutionText(
+ contract as FullContract,
+ resolution
+ )
return (
@@ -108,7 +138,11 @@ export function ResolutionOrChance(props: {
>
Resolved
- {resolutionText}
+ {resolutionText ? (
+ {resolutionText}
+ ) : (
+ {answerText}
+ )}
>
) : (
isBinary && (
diff --git a/web/components/contract/contract-overview.tsx b/web/components/contract/contract-overview.tsx
index 59a0462b..77a234b3 100644
--- a/web/components/contract/contract-overview.tsx
+++ b/web/components/contract/contract-overview.tsx
@@ -20,8 +20,8 @@ export const ContractOverview = (props: {
comments: Comment[]
className?: string
}) => {
- const { contract, bets, comments, className } = props
- const { question, resolution, creatorId, outcomeType } = contract
+ const { contract, bets, className } = props
+ const { question, creatorId, outcomeType } = contract
const user = useUser()
const isCreator = user?.id === creatorId
@@ -35,7 +35,7 @@ export const ContractOverview = (props: {
- {(isBinary || resolution) && (
+ {isBinary && (
-
- {(isBinary || resolution) && (
+ {isBinary ? (
+
- )}
- {isBinary && tradingAllowed(contract) && (
-
- )}
-
+ {tradingAllowed(contract) && (
+
+ )}
+
+ ) : (
+
+ )}
- {(isBinary || resolution) && (
+ {isBinary && (
)}