diff --git a/web/components/contract-card.tsx b/web/components/contract-card.tsx index 438f7ab2..1920c494 100644 --- a/web/components/contract-card.tsx +++ b/web/components/contract-card.tsx @@ -7,6 +7,7 @@ import { Linkify } from './linkify' import { Contract, compute, path } from '../lib/firebase/contracts' import { Col } from './layout/col' import { parseTags } from '../lib/util/parse' +import dayjs from 'dayjs' export function ContractCard(props: { contract: Contract }) { const { contract } = props @@ -104,7 +105,7 @@ export function AbbrContractDetails(props: { contract: Contract }) { export function ContractDetails(props: { contract: Contract }) { const { contract } = props - const { question, description } = contract + const { question, description, closeTime } = contract const { truePool, createdDate, resolvedDate } = compute(contract) const tags = parseTags(`${question} ${description}`).map((tag) => `#${tag}`) @@ -119,6 +120,15 @@ export function ContractDetails(props: { contract: Contract }) {
{resolvedDate ? `${createdDate} - ${resolvedDate}` : createdDate}
+ {!resolvedDate && closeTime && ( + <> +
+
+ {closeTime > Date.now() ? 'Closes' : 'Closed'}{' '} + {dayjs(closeTime).format('MMM D, h:mma')} +
+ + )}
{formatMoney(truePool)} pool
diff --git a/web/components/contract-feed.tsx b/web/components/contract-feed.tsx index 23995fa5..3e028e76 100644 --- a/web/components/contract-feed.tsx +++ b/web/components/contract-feed.tsx @@ -65,7 +65,7 @@ function Timestamp(props: { time: number }) { const { time } = props return ( {dayjs(time).fromNow()} diff --git a/web/components/contract-overview.tsx b/web/components/contract-overview.tsx index 88f788e9..0e0b7ecc 100644 --- a/web/components/contract-overview.tsx +++ b/web/components/contract-overview.tsx @@ -10,26 +10,12 @@ import { ContractProbGraph } from './contract-prob-graph' import router from 'next/router' import { useUser } from '../hooks/use-user' import { Row } from './layout/row' -import dayjs from 'dayjs' import { Linkify } from './linkify' import clsx from 'clsx' import { ContractDetails, ResolutionOrChance } from './contract-card' import { ContractFeed } from './contract-feed' import { TweetButton } from './tweet-button' -function ContractCloseTime(props: { contract: Contract }) { - const closeTime = props.contract.closeTime - if (!closeTime) { - return null - } - return ( -
- Trading {closeTime > Date.now() ? 'closes' : 'closed'} at{' '} - {dayjs(closeTime).format('MMM D, h:mma')} -
- ) -} - export const ContractOverview = (props: { contract: Contract className?: string @@ -103,10 +89,6 @@ export const ContractOverview = (props: { )} - - - - ) }