Show curreantly available, reset open to 0

This commit is contained in:
Ian Philips 2022-09-28 13:19:26 -04:00
parent 03957f0c22
commit 1d826f7da9
3 changed files with 12 additions and 3 deletions

View File

@ -40,6 +40,11 @@ export const onUpdateContract = functions.firestore
)
if (toBank.length <= fromBank.length) return
await firestore
.collection('contracts')
.doc(contract.id)
.update({ openCommentBounties: 0 })
const refunds = toBank.slice(fromBank.length)
await Promise.all(
refunds.map(async (extraBountyTxn) => {

View File

@ -15,6 +15,7 @@ export function AddCommentBountyPanel(props: { contract: Contract }) {
const user = useUser()
const amount = COMMENT_BOUNTY_AMOUNT
const totalAdded = contract.openCommentBounties ?? 0
const [error, setError] = useState<string | undefined>(undefined)
const [isSuccess, setIsSuccess] = useState(false)
const [isLoading, setIsLoading] = useState(false)
@ -43,7 +44,8 @@ export function AddCommentBountyPanel(props: { contract: Contract }) {
<>
<div className="mb-4 text-gray-500">
Add a {formatMoney(amount)} bounty for good comments that the creator
can award.
can award.{' '}
{totalAdded > 0 && `(${formatMoney(totalAdded)} currently added)`}
</div>
<Row className={'items-center gap-2'}>

View File

@ -50,9 +50,11 @@ export function ContractTabs(props: {
{
title: `Comments`,
tooltip: openCommentBounties
? `The creator of this market will award bounties of ${formatMoney(
? `The creator of this market may award ${formatMoney(
COMMENT_BOUNTY_AMOUNT
)} to good comments`
)} for good comments. ${formatMoney(
openCommentBounties
)} currently available.`
: undefined,
content: <CommentsTabContent contract={contract} />,
inlineTabIcon: <span>({formatMoney(COMMENT_BOUNTY_AMOUNT)})</span>,