market close fix oopsies (#886)

* market close fix
This commit is contained in:
ingawei 2022-09-16 02:38:09 -05:00 committed by GitHub
parent 833ec518b4
commit 256fd89fd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,6 +31,7 @@ import { useWindowSize } from 'web/hooks/use-window-size'
import { ExtraContractActionsRow } from './extra-contract-actions-row' import { ExtraContractActionsRow } from './extra-contract-actions-row'
import { PlusCircleIcon } from '@heroicons/react/solid' import { PlusCircleIcon } from '@heroicons/react/solid'
import { GroupLink } from 'common/group' import { GroupLink } from 'common/group'
import { Subtitle } from '../subtitle'
export type ShowTime = 'resolve-date' | 'close-date' export type ShowTime = 'resolve-date' | 'close-date'
@ -427,47 +428,59 @@ function EditableCloseDate(props: {
return ( return (
<> <>
{isEditingCloseTime ? ( <Modal
<Row className="z-10 mr-2 w-full shrink-0 items-center gap-1"> size="sm"
<input open={isEditingCloseTime}
type="date" setOpen={setIsEditingCloseTime}
className="input input-bordered shrink-0" position="top"
onClick={(e) => e.stopPropagation()} >
onChange={(e) => setCloseDate(e.target.value)} <Col className="rounded bg-white px-8 pb-8">
min={Date.now()} <Subtitle text="Edit Close Date" />
value={closeDate} <Row className="z-10 mr-2 w-full shrink-0 flex-wrap items-center gap-2">
/> <input
<input type="date"
type="time" className="input input-bordered w-full shrink-0 sm:w-fit"
className="input input-bordered shrink-0" onClick={(e) => e.stopPropagation()}
onClick={(e) => e.stopPropagation()} onChange={(e) => setCloseDate(e.target.value)}
onChange={(e) => setCloseHoursMinutes(e.target.value)} min={Date.now()}
min="00:00" value={closeDate}
value={closeHoursMinutes} />
/> <input
<Button size={'xs'} color={'blue'} onClick={onSave}> type="time"
className="input input-bordered w-full shrink-0 sm:w-max"
onClick={(e) => e.stopPropagation()}
onChange={(e) => setCloseHoursMinutes(e.target.value)}
min="00:00"
value={closeHoursMinutes}
/>
</Row>
<Button
className="mt-2"
size={'xs'}
color={'indigo'}
onClick={onSave}
>
Done Done
</Button> </Button>
</Row> </Col>
) : ( </Modal>
<DateTimeTooltip <DateTimeTooltip
text={closeTime > Date.now() ? 'Trading ends:' : 'Trading ended:'} text={closeTime > Date.now() ? 'Trading ends:' : 'Trading ended:'}
time={closeTime} time={closeTime}
>
<span
className={isCreator ? 'cursor-pointer' : ''}
onClick={() => isCreator && setIsEditingCloseTime(true)}
> >
<span {isSameDay ? (
className={isCreator ? 'cursor-pointer' : ''} <span className={'capitalize'}> {fromNow(closeTime)}</span>
onClick={() => isCreator && setIsEditingCloseTime(true)} ) : isSameYear ? (
> dayJsCloseTime.format('MMM D')
{isSameDay ? ( ) : (
<span className={'capitalize'}> {fromNow(closeTime)}</span> dayJsCloseTime.format('MMM D, YYYY')
) : isSameYear ? ( )}
dayJsCloseTime.format('MMM D') </span>
) : ( </DateTimeTooltip>
dayJsCloseTime.format('MMM D, YYYY')
)}
</span>
</DateTimeTooltip>
)}
</> </>
) )
} }