contract card: simplify date display
This commit is contained in:
parent
2320f0b962
commit
4cca60b16e
|
@ -156,30 +156,39 @@ export function ContractDetails(props: { contract: Contract }) {
|
|||
username={creatorUsername}
|
||||
/>
|
||||
<div className="">•</div>
|
||||
|
||||
<div className="whitespace-nowrap">
|
||||
<DateTimeTooltip time={contract.createdTime}>
|
||||
<DateTimeTooltip text="Market created:" time={contract.createdTime}>
|
||||
{createdDate}
|
||||
</DateTimeTooltip>
|
||||
|
||||
{resolvedDate && contract.resolutionTime ? (
|
||||
<>
|
||||
{' - '}
|
||||
<DateTimeTooltip time={contract.resolutionTime}>
|
||||
<DateTimeTooltip
|
||||
text="Market resolved:"
|
||||
time={contract.resolutionTime}
|
||||
>
|
||||
{resolvedDate}
|
||||
</DateTimeTooltip>
|
||||
</>
|
||||
) : null}
|
||||
</div>
|
||||
{!resolvedDate && closeTime && (
|
||||
<>
|
||||
<div className="">•</div>
|
||||
<div className="whitespace-nowrap">
|
||||
{closeTime > Date.now() ? 'Closes' : 'Closed'}{' '}
|
||||
<DateTimeTooltip time={closeTime}>
|
||||
|
||||
{!resolvedDate && closeTime && (
|
||||
<>
|
||||
{' - '}
|
||||
<DateTimeTooltip
|
||||
text={
|
||||
closeTime > Date.now() ? 'Market closes: ' : 'Market closed:'
|
||||
}
|
||||
time={closeTime}
|
||||
>
|
||||
{dayjs(closeTime).format('MMM D, YYYY')}
|
||||
</DateTimeTooltip>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="">•</div>
|
||||
<div className="whitespace-nowrap">{formatMoney(truePool)} pool</div>
|
||||
</Row>
|
||||
|
|
|
@ -9,14 +9,19 @@ dayjs.extend(advanced)
|
|||
|
||||
export function DateTimeTooltip(props: {
|
||||
time: number
|
||||
text?: string
|
||||
children?: React.ReactNode
|
||||
}) {
|
||||
const { time } = props
|
||||
const { time, text } = props
|
||||
|
||||
const formattedTime = dayjs(time).format('MMM DD, YYYY hh:mm a z')
|
||||
const toolTip = text ? `${text} ${formattedTime}` : formattedTime
|
||||
|
||||
return (
|
||||
<>
|
||||
<span
|
||||
className="tooltip cursor-default hidden sm:inline-block"
|
||||
data-tip={dayjs(time).format('MMM DD, YYYY hh:mm a z')}
|
||||
data-tip={toolTip}
|
||||
>
|
||||
{props.children}
|
||||
</span>
|
||||
|
|
Loading…
Reference in New Issue
Block a user