Show curreantly available, reset open to 0
This commit is contained in:
parent
03957f0c22
commit
1d826f7da9
|
@ -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) => {
|
||||
|
|
|
@ -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'}>
|
||||
|
|
|
@ -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>,
|
||||
|
|
Loading…
Reference in New Issue
Block a user