Mock display automatic resolution

This commit is contained in:
Milli 2022-05-28 22:34:30 +02:00
parent fe2c90d011
commit e1e194005c

View File

@ -109,8 +109,8 @@ export function ContractDetails(props: {
disabled?: boolean disabled?: boolean
}) { }) {
const { contract, bets, isCreator, disabled } = props const { contract, bets, isCreator, disabled } = props
const { closeTime, creatorName, creatorUsername } = contract const { closeTime, automaticResolutionTime, creatorName, creatorUsername } = contract
const { volumeLabel, automaticResolutionDate, resolvedDate } = contractMetrics(contract) const { volumeLabel, resolvedDate } = contractMetrics(contract)
return ( return (
<Row className="flex-1 flex-wrap items-center gap-x-4 gap-y-2 text-sm text-gray-500"> <Row className="flex-1 flex-wrap items-center gap-x-4 gap-y-2 text-sm text-gray-500">
@ -157,6 +157,7 @@ export function ContractDetails(props: {
{/* {' - '}{' '} */} {/* {' - '}{' '} */}
<EditableCloseDate <EditableCloseDate
closeTime={closeTime} closeTime={closeTime}
resolveTime={automaticResolutionTime}
contract={contract} contract={contract}
isCreator={isCreator ?? false} isCreator={isCreator ?? false}
/> />
@ -164,16 +165,6 @@ export function ContractDetails(props: {
)} )}
</Row> </Row>
)} )}
{!resolvedDate && contract.automaticResolutionTime && (
<DateTimeTooltip
text="Market automatically resolving:"
time={contract.automaticResolutionTime}
>
{automaticResolutionDate + ": " + contract.automaticResolution}
</DateTimeTooltip>
)}
<Row className="items-center gap-1"> <Row className="items-center gap-1">
<DatabaseIcon className="h-5 w-5" /> <DatabaseIcon className="h-5 w-5" />
@ -206,10 +197,11 @@ export function contractTextDetails(contract: Contract) {
function EditableCloseDate(props: { function EditableCloseDate(props: {
closeTime: number closeTime: number
resolveTime: number | undefined
contract: Contract contract: Contract
isCreator: boolean isCreator: boolean
}) { }) {
const { closeTime, contract, isCreator } = props const { closeTime, resolveTime, contract, isCreator } = props
const [isEditingCloseTime, setIsEditingCloseTime] = useState(false) const [isEditingCloseTime, setIsEditingCloseTime] = useState(false)
const [closeDate, setCloseDate] = useState( const [closeDate, setCloseDate] = useState(
@ -250,15 +242,30 @@ function EditableCloseDate(props: {
/> />
</div> </div>
) : ( ) : (
<DateTimeTooltip <>
text={closeTime > Date.now() ? 'Trading ends:' : 'Trading ended:'} <DateTimeTooltip
time={closeTime} text={closeTime > Date.now() ? 'Trading ends:' : 'Trading ended:'}
> time={closeTime}
{isSameYear >
? dayjs(closeTime).format('MMM D') {isSameYear
: dayjs(closeTime).format('MMM D, YYYY')} ? dayjs(closeTime).format('MMM D')
{isSameDay && <> ({fromNow(closeTime)})</>} : dayjs(closeTime).format('MMM D, YYYY')}
</DateTimeTooltip> {isSameDay && <> ({fromNow(closeTime)})</>}
</DateTimeTooltip>
{resolveTime && (
<DateTimeTooltip
text={resolveTime > Date.now() ? 'Market resolves as \'MKT\':' : ''}
time={resolveTime}
>
{"/ "}
{isSameYear
? dayjs(resolveTime).format('MMM D')
: dayjs(resolveTime).format('MMM D, YYYY')}
{isSameDay && <> ({fromNow(resolveTime)})</>}
{": 'MKT'"}
</DateTimeTooltip>
)}
</>
)} )}
{isCreator && {isCreator &&