diff --git a/web/components/contract/contract-details.tsx b/web/components/contract/contract-details.tsx index e1a6503e..acfa64e8 100644 --- a/web/components/contract/contract-details.tsx +++ b/web/components/contract/contract-details.tsx @@ -106,7 +106,8 @@ export function ContractDetails(props: { disabled?: boolean }) { const { contract, bets, isCreator, disabled } = props - const { closeTime, autoResolutionTime, creatorName, creatorUsername } = contract + const { closeTime, autoResolutionTime, creatorName, creatorUsername } = + contract const { volumeLabel, resolvedDate } = contractMetrics(contract) return ( @@ -167,7 +168,13 @@ export function ContractDetails(props: {
{volumeLabel}
- {!disabled && } + {!disabled && ( + + )} ) } @@ -215,14 +222,18 @@ function EditableCloseDate(props: { const newAutoResolutionTime = newCloseTime + 7 * DAY_MS let newDescription = `${description}\n\nClose date updated to ${formattedCloseDate}` - const update : Partial = { - closeTime: newCloseTime + const update: Partial = { + closeTime: newCloseTime, } if (newAutoResolutionTime >= autoResolutionTime) { update.autoResolutionTime = newAutoResolutionTime - const formattedNewAutoResolutionTime = dayjs(newAutoResolutionTime).format('YYYY-MM-DD h:mm a') - newDescription = newDescription.concat(`\nAuto resolution date updated to ${formattedNewAutoResolutionTime}`) + const formattedNewAutoResolutionTime = dayjs( + newAutoResolutionTime + ).format('YYYY-MM-DD h:mm a') + newDescription = newDescription.concat( + `\nAuto resolution date updated to ${formattedNewAutoResolutionTime}` + ) } update.description = newDescription diff --git a/web/components/contract/contract-info-dialog.tsx b/web/components/contract/contract-info-dialog.tsx index ae7cccc2..3e08d4a6 100644 --- a/web/components/contract/contract-info-dialog.tsx +++ b/web/components/contract/contract-info-dialog.tsx @@ -1,4 +1,8 @@ -import { DotsHorizontalIcon, PencilIcon, CheckIcon } from '@heroicons/react/outline' +import { + DotsHorizontalIcon, + PencilIcon, + CheckIcon, +} from '@heroicons/react/outline' import clsx from 'clsx' import dayjs from 'dayjs' import { uniqBy } from 'lodash' @@ -25,12 +29,22 @@ import { TweetButton } from '../tweet-button' const formatTime = (dt: number) => dayjs(dt).format('MMM DD, YYYY hh:mm a z') -export function ContractInfoDialog(props: { contract: Contract; bets: Bet[]; isCreator: boolean }) { +export function ContractInfoDialog(props: { + contract: Contract + bets: Bet[] + isCreator: boolean +}) { const { contract, bets, isCreator } = props const [open, setOpen] = useState(false) - const { createdTime, closeTime, resolutionTime, autoResolutionTime, autoResolution } = contract + const { + createdTime, + closeTime, + resolutionTime, + autoResolutionTime, + autoResolution, + } = contract const tradersCount = uniqBy(bets, 'userId').length return ( @@ -89,9 +103,9 @@ export function ContractInfoDialog(props: { contract: Contract; bets: Bet[]; isC isCreator={isCreator} /> - Auto resolution - {contract.autoResolution} - + Auto resolution + {contract.autoResolution} + )} @@ -176,10 +190,10 @@ export function EditableResolutionTime(props: { const onSave = () => { const newTime = dayjs(timeString).valueOf() if (newTime === time) setIsEditing(false) - else if ( contract.closeTime && newTime > (contract.closeTime ?? Date.now)) { + else if (contract.closeTime && newTime > (contract.closeTime ?? Date.now)) { const formattedTime = dayjs(time).format('YYYY-MM-DD h:mm a') const newDescription = `${contract.description}\n\nAuto resolution date updated to ${formattedTime}` - + updateContract(contract.id, { autoResolutionTime: newTime, description: newDescription, @@ -193,17 +207,19 @@ export function EditableResolutionTime(props: { Market autoresolves - {isCreator && ( - isEditing ? ( + {isCreator && + (isEditing ? ( - ):( - - ))} + ))} {isEditing ? ( @@ -218,7 +234,9 @@ export function EditableResolutionTime(props: { /> ) : ( -
{formatTime(time)}
+
+ {formatTime(time)} +
)} diff --git a/web/components/outcome-label.tsx b/web/components/outcome-label.tsx index 0d28a940..6daa855b 100644 --- a/web/components/outcome-label.tsx +++ b/web/components/outcome-label.tsx @@ -3,7 +3,12 @@ import { ReactNode } from 'react' import { Answer } from 'common/answer' import { getProbability } from 'common/calculate' import { getValueFromBucket } from 'common/calculate-dpm' -import { BinaryContract, Contract, FreeResponseContract, resolution } from 'common/contract' +import { + BinaryContract, + Contract, + FreeResponseContract, + resolution, +} from 'common/contract' import { formatPercent } from 'common/util/format' import { ClientRender } from './client-render' @@ -35,9 +40,7 @@ export function OutcomeLabel(props: { ) } -export function BinaryOutcomeLabel(props: { - outcome: resolution -}) { +export function BinaryOutcomeLabel(props: { outcome: resolution }) { const { outcome } = props if (outcome === 'YES') return diff --git a/web/lib/firebase/contracts.ts b/web/lib/firebase/contracts.ts index 65e37889..b0105d10 100644 --- a/web/lib/firebase/contracts.ts +++ b/web/lib/firebase/contracts.ts @@ -42,7 +42,8 @@ export function contractUrl(contract: Contract) { } export function contractMetrics(contract: Contract) { - const { createdTime, resolutionTime, isResolved, autoResolutionTime } = contract + const { createdTime, resolutionTime, isResolved, autoResolutionTime } = + contract const createdDate = dayjs(createdTime).format('MMM D') const autoResolutionDate = dayjs(autoResolutionTime).format('MMM D')