diff --git a/web/components/contract-overview.tsx b/web/components/contract-overview.tsx index 72fa3dff..e36b3d79 100644 --- a/web/components/contract-overview.tsx +++ b/web/components/contract-overview.tsx @@ -1,4 +1,9 @@ -import { compute, Contract, deleteContract } from '../lib/firebase/contracts' +import { + compute, + Contract, + deleteContract, + path, +} from '../lib/firebase/contracts' import { Col } from './layout/col' import { Spacer } from './layout/spacer' import { ContractProbGraph } from './contract-prob-graph' @@ -10,6 +15,7 @@ import { Linkify } from './linkify' import clsx from 'clsx' import { ContractDetails, ResolutionOrChance } from './contract-card' import { ContractFeed } from './contract-feed' +import { TweetButton } from './tweet-button' function ContractCloseTime(props: { contract: Contract }) { const closeTime = props.contract.closeTime @@ -29,12 +35,23 @@ export const ContractOverview = (props: { className?: string }) => { const { contract, className } = props - const { resolution, creatorId } = contract + const { resolution, creatorId, creatorName } = contract const { probPercent, truePool } = compute(contract) const user = useUser() const isCreator = user?.id === creatorId + const tweetQuestion = isCreator + ? contract.question + : `${creatorName}: ${contract.question}` + const tweetDescription = resolution + ? isCreator + ? `Resolved ${resolution}!` + : `Resolved ${resolution} by ${creatorName}:` + : `Currently ${probPercent} chance, place your bets here:` + const url = `https://mantic.markets${path(contract)}` + const tweetText = `${tweetQuestion}\n\n${tweetDescription}\n\n${url}` + return (