Merge branch 'main' into atlas2

This commit is contained in:
Austin Chen 2022-07-05 16:53:13 -07:00
commit 1cf9605663
2 changed files with 7 additions and 21 deletions

View File

@ -7,11 +7,7 @@ import { Bet } from 'common/bet'
import { Contract } from 'common/contract' import { Contract } from 'common/contract'
import { formatMoney } from 'common/util/format' import { formatMoney } from 'common/util/format'
import { import { contractPath, contractPool } from 'web/lib/firebase/contracts'
contractPath,
contractPool,
getBinaryProbPercent,
} from 'web/lib/firebase/contracts'
import { LiquidityPanel } from '../liquidity-panel' import { LiquidityPanel } from '../liquidity-panel'
import { Col } from '../layout/col' import { Col } from '../layout/col'
import { Modal } from '../layout/modal' import { Modal } from '../layout/modal'
@ -69,7 +65,7 @@ export function ContractInfoDialog(props: { contract: Contract; bets: Bet[] }) {
<Row className="justify-start gap-4"> <Row className="justify-start gap-4">
<TweetButton <TweetButton
className="self-start" className="self-start"
tweetText={getTweetText(contract, false)} tweetText={getTweetText(contract)}
/> />
<ShareEmbedButton contract={contract} toastClassName={'-left-20'} /> <ShareEmbedButton contract={contract} toastClassName={'-left-20'} />
<DuplicateContractButton contract={contract} /> <DuplicateContractButton contract={contract} />
@ -157,23 +153,13 @@ export function ContractInfoDialog(props: { contract: Contract; bets: Bet[] }) {
) )
} }
const getTweetText = (contract: Contract, isCreator: boolean) => { const getTweetText = (contract: Contract) => {
const { question, creatorName, resolution, outcomeType } = contract const { question, resolution } = contract
const isBinary = outcomeType === 'BINARY'
const tweetQuestion = isCreator const tweetDescription = resolution ? `\n\nResolved ${resolution}!` : ''
? question
: `${question}\nAsked by ${creatorName}.`
const tweetDescription = resolution
? `Resolved ${resolution}!`
: isBinary
? `Currently ${getBinaryProbPercent(
contract
)} chance, place your bets here:`
: `Submit your own answer:`
const timeParam = `${Date.now()}`.substring(7) const timeParam = `${Date.now()}`.substring(7)
const url = `https://manifold.markets${contractPath(contract)}?t=${timeParam}` const url = `https://manifold.markets${contractPath(contract)}?t=${timeParam}`
return `${tweetQuestion}\n\n${tweetDescription}\n\n${url}` return `${question}\n\n${url}${tweetDescription}`
} }