From 8c644da10db07dc868994357137de8ae856acf1c Mon Sep 17 00:00:00 2001 From: jahooma Date: Sat, 1 Jan 2022 22:52:55 -0600 Subject: [PATCH] Update contract title with resolution or percent chance --- web/pages/[username]/[contractSlug].tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/web/pages/[username]/[contractSlug].tsx b/web/pages/[username]/[contractSlug].tsx index 60a1a5fb..4fe92741 100644 --- a/web/pages/[username]/[contractSlug].tsx +++ b/web/pages/[username]/[contractSlug].tsx @@ -11,7 +11,11 @@ import { useBets } from '../../hooks/use-bets' import { Title } from '../../components/title' import { Spacer } from '../../components/layout/spacer' import { User } from '../../lib/firebase/users' -import { Contract, getContractFromSlug } from '../../lib/firebase/contracts' +import { + compute, + Contract, + getContractFromSlug, +} from '../../lib/firebase/contracts' import { SEO } from '../../components/SEO' import { Page } from '../../components/page' @@ -47,13 +51,18 @@ export default function ContractPage(props: { return
Contract not found...
} - const { creatorId, isResolved } = contract + const { creatorId, isResolved, resolution, question } = contract const isCreator = user?.id === creatorId + const { probPercent } = compute(contract) + const title = resolution + ? `Resolved ${resolution}: ${question}` + : `${probPercent} chance: ${question}` + return (