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-dpm'
import { parseWordsAsTags } from '../../common/util/parse'
import { AmountInput } from '../components/amount-input'
import { InfoTooltip } from '../components/info-tooltip'
import { Col } from '../components/layout/col'
import { Row } from '../components/layout/row'
import { Spacer } from '../components/layout/spacer'
import { Linkify } from '../components/linkify'
import { Page } from '../components/page'
import { Title } from '../components/title'
import { useUser } from '../hooks/use-user'
import { createContract } from '../lib/firebase/api-call'
import { Contract, contractPath } from '../lib/firebase/contracts'
type Prediction = {
question: string
description: string
initialProb: number
createdUrl?: string
}
function toPrediction(contract: Contract): Prediction {
const startProb = getProbability(contract.totalShares)
return {
question: contract.question,
description: contract.description,
initialProb: startProb * 100,
createdUrl: contractPath(contract),
}
}
function PredictionRow(props: { prediction: Prediction }) {
const { prediction } = props
return (