import clsx from 'clsx'
import dayjs from 'dayjs'
import Link from 'next/link'
import { useState } from 'react'
import Textarea from 'react-expanding-textarea'
import { getProbability } from 'common/calculate'
import { BinaryContract } from 'common/contract'
import { parseWordsAsTags } from 'common/util/parse'
import { BuyAmountInput } from 'web/components/amount-input'
import { InfoTooltip } from 'web/components/info-tooltip'
import { Col } from 'web/components/layout/col'
import { Row } from 'web/components/layout/row'
import { Spacer } from 'web/components/layout/spacer'
import { Linkify } from 'web/components/linkify'
import { Page } from 'web/components/page'
import { Title } from 'web/components/title'
import { useUser } from 'web/hooks/use-user'
import { createMarket } from 'web/lib/firebase/api-call'
import { contractPath } from 'web/lib/firebase/contracts'
type Prediction = {
question: string
description: string
initialProb: number
createdUrl?: string
}
function toPrediction(contract: BinaryContract): Prediction {
const startProb = getProbability(contract)
return {
question: contract.question,
description: contract.description,
initialProb: startProb * 100,
createdUrl: contractPath(contract),
}
}
function PredictionRow(props: { prediction: Prediction }) {
const { prediction } = props
return (