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
This commit is contained in:
Ben Congdon 2022-06-16 20:52:53 -07:00 committed by GitHub
parent f063d5cd24
commit a8ae724159
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -24,6 +24,7 @@ import NewContractBadge from '../new-contract-badge'
import { CATEGORY_LIST } from 'common/categories' import { CATEGORY_LIST } from 'common/categories'
import { TagsList } from '../tags-list' import { TagsList } from '../tags-list'
import { UserFollowButton } from '../follow-button' import { UserFollowButton } from '../follow-button'
import { DAY_MS } from 'common/util/time'
export function MiscDetails(props: { export function MiscDetails(props: {
contract: Contract contract: Contract
@ -31,11 +32,13 @@ export function MiscDetails(props: {
showCloseTime?: boolean showCloseTime?: boolean
}) { }) {
const { contract, showHotVolume, showCloseTime } = props 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 // Show at most one category that this contract is tagged by
const categories = CATEGORY_LIST.filter((category) => const categories = CATEGORY_LIST.filter((category) =>
tags.map((t) => t.toLowerCase()).includes(category) tags.map((t) => t.toLowerCase()).includes(category)
).slice(0, 1) ).slice(0, 1)
const isNew = createdTime > Date.now() - DAY_MS && !isResolved
return ( return (
<Row className="items-center gap-3 text-sm text-gray-400"> <Row className="items-center gap-3 text-sm text-gray-400">
@ -49,7 +52,7 @@ export function MiscDetails(props: {
{(closeTime || 0) < Date.now() ? 'Closed' : 'Closes'}{' '} {(closeTime || 0) < Date.now() ? 'Closed' : 'Closes'}{' '}
{fromNow(closeTime || 0)} {fromNow(closeTime || 0)}
</Row> </Row>
) : volume > 0 ? ( ) : volume > 0 || !isNew ? (
<Row>{contractPool(contract)} pool</Row> <Row>{contractPool(contract)} pool</Row>
) : ( ) : (
<NewContractBadge /> <NewContractBadge />

View File

@ -109,10 +109,11 @@ export function FeedQuestion(props: {
outcomeType, outcomeType,
volume, volume,
createdTime, createdTime,
isResolved,
} = contract } = contract
const { volumeLabel } = contractMetrics(contract) const { volumeLabel } = contractMetrics(contract)
const isBinary = outcomeType === 'BINARY' const isBinary = outcomeType === 'BINARY'
const isNew = createdTime > Date.now() - DAY_MS const isNew = createdTime > Date.now() - DAY_MS && !isResolved
return ( return (
<div className={'flex gap-2'}> <div className={'flex gap-2'}>