From 4cca60b16e791c470ead584406c783ac681fdf2d Mon Sep 17 00:00:00 2001 From: mantikoros Date: Wed, 19 Jan 2022 16:01:54 -0600 Subject: [PATCH] contract card: simplify date display --- web/components/contract-card.tsx | 33 ++++++++++++++++++----------- web/components/datetime-tooltip.tsx | 9 ++++++-- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/web/components/contract-card.tsx b/web/components/contract-card.tsx index a452fec1..53b9f131 100644 --- a/web/components/contract-card.tsx +++ b/web/components/contract-card.tsx @@ -156,30 +156,39 @@ export function ContractDetails(props: { contract: Contract }) { username={creatorUsername} />
+
- + {createdDate} + {resolvedDate && contract.resolutionTime ? ( <> {' - '} - + {resolvedDate} ) : null} -
- {!resolvedDate && closeTime && ( - <> -
-
- {closeTime > Date.now() ? 'Closes' : 'Closed'}{' '} - + + {!resolvedDate && closeTime && ( + <> + {' - '} + Date.now() ? 'Market closes: ' : 'Market closed:' + } + time={closeTime} + > {dayjs(closeTime).format('MMM D, YYYY')} -
- - )} + + )} + +
{formatMoney(truePool)} pool
diff --git a/web/components/datetime-tooltip.tsx b/web/components/datetime-tooltip.tsx index c6bd1723..064943ff 100644 --- a/web/components/datetime-tooltip.tsx +++ b/web/components/datetime-tooltip.tsx @@ -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 ( <> {props.children}