diff --git a/web/components/contract/contract-details.tsx b/web/components/contract/contract-details.tsx index 629c046c..354f4394 100644 --- a/web/components/contract/contract-details.tsx +++ b/web/components/contract/contract-details.tsx @@ -233,7 +233,7 @@ export function ContractDetails(props: { {resolvedDate} @@ -322,7 +322,7 @@ function EditableCloseDate(props: { ) : ( Date.now() ? 'Trading ends:' : 'Trading ended:'} - time={dayJsCloseTime} + time={closeTime} > {isSameYear ? dayJsCloseTime.format('MMM D') diff --git a/web/components/datetime-tooltip.tsx b/web/components/datetime-tooltip.tsx index d820e728..c81d5d88 100644 --- a/web/components/datetime-tooltip.tsx +++ b/web/components/datetime-tooltip.tsx @@ -1,15 +1,12 @@ -import dayjs, { Dayjs } from 'dayjs' -import utc from 'dayjs/plugin/utc' -import timezone from 'dayjs/plugin/timezone' -import advanced from 'dayjs/plugin/advancedFormat' import { Tooltip } from './tooltip' -dayjs.extend(utc) -dayjs.extend(timezone) -dayjs.extend(advanced) +const FORMATTER = new Intl.DateTimeFormat('default', { + dateStyle: 'medium', + timeStyle: 'long', +}) export function DateTimeTooltip(props: { - time: Dayjs + time: number text?: string className?: string children?: React.ReactNode @@ -17,7 +14,7 @@ export function DateTimeTooltip(props: { }) { const { className, time, text, noTap } = props - const formattedTime = time.format('MMM DD, YYYY hh:mm a z') + const formattedTime = FORMATTER.format(time) const toolTip = text ? `${text} ${formattedTime}` : formattedTime return ( diff --git a/web/components/feed/copy-link-date-time.tsx b/web/components/feed/copy-link-date-time.tsx index 8238d3e3..cea8300a 100644 --- a/web/components/feed/copy-link-date-time.tsx +++ b/web/components/feed/copy-link-date-time.tsx @@ -7,7 +7,6 @@ import { fromNow } from 'web/lib/util/time' import { ToastClipboard } from 'web/components/toast-clipboard' import { LinkIcon } from '@heroicons/react/outline' import clsx from 'clsx' -import dayjs from 'dayjs' export function CopyLinkDateTimeComponent(props: { prefix: string @@ -18,7 +17,6 @@ export function CopyLinkDateTimeComponent(props: { }) { const { prefix, slug, elementId, createdTime, className } = props const [showToast, setShowToast] = useState(false) - const time = dayjs(createdTime) function copyLinkToComment( event: React.MouseEvent @@ -32,7 +30,7 @@ export function CopyLinkDateTimeComponent(props: { } return (
- + copyLinkToComment(event)} diff --git a/web/components/feed/feed-bets.tsx b/web/components/feed/feed-bets.tsx index ffa53de3..e4200593 100644 --- a/web/components/feed/feed-bets.tsx +++ b/web/components/feed/feed-bets.tsx @@ -6,13 +6,10 @@ import { useUser, useUserById } from 'web/hooks/use-user' import { Row } from 'web/components/layout/row' import { Avatar, EmptyAvatar } from 'web/components/avatar' import clsx from 'clsx' -import { UsersIcon } from '@heroicons/react/solid' import { formatMoney, formatPercent } from 'common/util/format' import { OutcomeLabel } from 'web/components/outcome-label' import { RelativeTimestamp } from 'web/components/relative-timestamp' -import React, { Fragment, useEffect } from 'react' -import { uniqBy, partition, sumBy, groupBy } from 'lodash' -import { JoinSpans } from 'web/components/join-spans' +import React, { useEffect } from 'react' import { UserLink } from '../user-page' import { formatNumericProbability } from 'common/pseudo-numeric' import { SiteLink } from 'web/components/site-link' @@ -154,79 +151,3 @@ export function BetStatusText(props: {
) } - -function BetGroupSpan(props: { - contract: Contract - bets: Bet[] - outcome?: string -}) { - const { contract, bets, outcome } = props - - const numberTraders = uniqBy(bets, (b) => b.userId).length - - const [buys, sells] = partition(bets, (bet) => bet.amount >= 0) - const buyTotal = sumBy(buys, (b) => b.amount) - const sellTotal = sumBy(sells, (b) => -b.amount) - - return ( - - {numberTraders} {numberTraders > 1 ? 'traders' : 'trader'}{' '} - - {buyTotal > 0 && <>bought {formatMoney(buyTotal)} } - {sellTotal > 0 && <>sold {formatMoney(sellTotal)} } - - {outcome && ( - <> - {' '} - of{' '} - - - )}{' '} - - ) -} - -export function FeedBetGroup(props: { - contract: Contract - bets: Bet[] - hideOutcome: boolean -}) { - const { contract, bets, hideOutcome } = props - - const betGroups = groupBy(bets, (bet) => bet.outcome) - const outcomes = Object.keys(betGroups) - - // Use the time of the last bet for the entire group - const createdTime = bets[bets.length - 1].createdTime - - return ( - <> -
-
-
-
-
-
-
-
- {outcomes.map((outcome, index) => ( - - - {index !== outcomes.length - 1 &&
} -
- ))} - -
-
- - ) -} diff --git a/web/components/relative-timestamp.tsx b/web/components/relative-timestamp.tsx index bd029cf6..53cf2a3a 100644 --- a/web/components/relative-timestamp.tsx +++ b/web/components/relative-timestamp.tsx @@ -8,7 +8,7 @@ export function RelativeTimestamp(props: { time: number }) { return ( {dayJsTime.fromNow()} diff --git a/web/components/tooltip.tsx b/web/components/tooltip.tsx index ef8f5bb8..4dd1f6e2 100644 --- a/web/components/tooltip.tsx +++ b/web/components/tooltip.tsx @@ -11,7 +11,6 @@ import { useRole, } from '@floating-ui/react-dom-interactions' import { Transition } from '@headlessui/react' -import clsx from 'clsx' import { ReactNode, useRef, useState } from 'react' // See https://floating-ui.com/docs/react-dom @@ -58,14 +57,10 @@ export function Tooltip(props: { }[placement.split('-')[0]] as string return text ? ( -
-
+ <> + {children} -
+ {/* conditionally render tooltip and fade in/out */} -
+ ) : ( <>{children} ) diff --git a/web/pages/tournaments/index.tsx b/web/pages/tournaments/index.tsx index feb4dd8d..ec952356 100644 --- a/web/pages/tournaments/index.tsx +++ b/web/pages/tournaments/index.tsx @@ -188,7 +188,7 @@ function Section(props: { )} {endTime && ( - + {endTime.format('MMM D')}