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

@ -17,7 +17,7 @@ export const getMappedValue =
if (isLogScale) {
const logValue = p * Math.log10(max - min)
return 10 ** logValue + min
return 10 ** logValue + min
}
return p * (max - min) + min

View File

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