diff --git a/web/components/contract/bountied-contract-badge.tsx b/web/components/contract/bountied-contract-badge.tsx index 1f371b14..27901cf0 100644 --- a/web/components/contract/bountied-contract-badge.tsx +++ b/web/components/contract/bountied-contract-badge.tsx @@ -3,9 +3,9 @@ import { useState } from 'react' import { CurrencyDollarIcon } from '@heroicons/react/outline' import { Contract } from 'common/contract' -import { Tooltip } from 'web/components/tooltip' -import { formatMoney } from 'common/util/format' import { COMMENT_BOUNTY_AMOUNT } from 'common/economy' +import { formatMoney } from 'common/util/format' +import { Tooltip } from 'web/components/tooltip' import { CommentBountyDialog } from './comment-bounty-dialog' export function BountiedContractBadge() { @@ -30,13 +30,20 @@ export function BountiedContractSmallBadge(props: { const modal = ( ) - if (!openCommentBounties) + + const bountiesClosed = + contract.isResolved || (contract.closeTime ?? Infinity) < Date.now() + + if (!openCommentBounties) { + if (bountiesClosed) return <> + return ( <> {modal} setOpen(true)} /> ) + } const tooltip = `${contract.creatorName} may award ${formatMoney( COMMENT_BOUNTY_AMOUNT @@ -49,7 +56,7 @@ export function BountiedContractSmallBadge(props: { {modal} setOpen(true)} + onClick={bountiesClosed ? undefined : () => setOpen(true)} /> ) @@ -57,11 +64,13 @@ export function BountiedContractSmallBadge(props: { function SmallBadge(props: { text: string; onClick?: () => void }) { const { text, onClick } = props + return (