From a8ae724159dbff31cc88ee073ca166d041c564aa Mon Sep 17 00:00:00 2001 From: Ben Congdon Date: Thu, 16 Jun 2022 20:52:53 -0700 Subject: [PATCH] Don't show the 'New' chip on resolved markets (#523) * Don't show the 'New' chip on resolved markets * Add createdTime check to contract-details --- web/components/contract/contract-details.tsx | 7 +++++-- web/components/feed/feed-items.tsx | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/web/components/contract/contract-details.tsx b/web/components/contract/contract-details.tsx index 9f9c0936..ee289702 100644 --- a/web/components/contract/contract-details.tsx +++ b/web/components/contract/contract-details.tsx @@ -24,6 +24,7 @@ import NewContractBadge from '../new-contract-badge' import { CATEGORY_LIST } from 'common/categories' import { TagsList } from '../tags-list' import { UserFollowButton } from '../follow-button' +import { DAY_MS } from 'common/util/time' export function MiscDetails(props: { contract: Contract @@ -31,11 +32,13 @@ export function MiscDetails(props: { showCloseTime?: boolean }) { const { contract, showHotVolume, showCloseTime } = props - const { volume, volume24Hours, closeTime, tags } = contract + const { volume, volume24Hours, closeTime, tags, isResolved, createdTime } = + contract // Show at most one category that this contract is tagged by const categories = CATEGORY_LIST.filter((category) => tags.map((t) => t.toLowerCase()).includes(category) ).slice(0, 1) + const isNew = createdTime > Date.now() - DAY_MS && !isResolved return ( @@ -49,7 +52,7 @@ export function MiscDetails(props: { {(closeTime || 0) < Date.now() ? 'Closed' : 'Closes'}{' '} {fromNow(closeTime || 0)} - ) : volume > 0 ? ( + ) : volume > 0 || !isNew ? ( {contractPool(contract)} pool ) : ( diff --git a/web/components/feed/feed-items.tsx b/web/components/feed/feed-items.tsx index ac39f1a4..ef0d133b 100644 --- a/web/components/feed/feed-items.tsx +++ b/web/components/feed/feed-items.tsx @@ -109,10 +109,11 @@ export function FeedQuestion(props: { outcomeType, volume, createdTime, + isResolved, } = contract const { volumeLabel } = contractMetrics(contract) const isBinary = outcomeType === 'BINARY' - const isNew = createdTime > Date.now() - DAY_MS + const isNew = createdTime > Date.now() - DAY_MS && !isResolved return (