import React from 'react' import { compute, Contract, deleteContract } from '../lib/firebase/contracts' import { Col } from './layout/col' import { Spacer } from './layout/spacer' import { ContractProbGraph } from './contract-prob-graph' import { ContractDetails } from './contracts-list' import router from 'next/router' import { useUser } from '../hooks/use-user' export const ContractOverview = (props: { contract: Contract className?: string }) => { const { contract, className } = props const { resolution, creatorId, isResolved } = contract const { probPercent, volume } = compute(contract) const user = useUser() const isCreator = user?.id === creatorId const resolutionColor = resolution === 'YES' ? 'text-primary' : resolution === 'NO' ? 'text-red-400' : resolution === 'CANCEL' ? 'text-yellow-400' : '' return (
{contract.question}
{resolution ? (
Resolved:
{resolution}
) : ( {probPercent}
chance
)}
{contract.description}
{/* Show a delete button for contracts without any trading */} {isCreator && volume === 0 && ( <> )} ) }