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
|
if (toBank.length <= fromBank.length) return
|
||||||
|
|
||||||
|
await firestore
|
||||||
|
.collection('contracts')
|
||||||
|
.doc(contract.id)
|
||||||
|
.update({ openCommentBounties: 0 })
|
||||||
|
|
||||||
const refunds = toBank.slice(fromBank.length)
|
const refunds = toBank.slice(fromBank.length)
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
refunds.map(async (extraBountyTxn) => {
|
refunds.map(async (extraBountyTxn) => {
|
||||||
|
|
|
@ -15,6 +15,7 @@ export function AddCommentBountyPanel(props: { contract: Contract }) {
|
||||||
|
|
||||||
const user = useUser()
|
const user = useUser()
|
||||||
const amount = COMMENT_BOUNTY_AMOUNT
|
const amount = COMMENT_BOUNTY_AMOUNT
|
||||||
|
const totalAdded = contract.openCommentBounties ?? 0
|
||||||
const [error, setError] = useState<string | undefined>(undefined)
|
const [error, setError] = useState<string | undefined>(undefined)
|
||||||
const [isSuccess, setIsSuccess] = useState(false)
|
const [isSuccess, setIsSuccess] = useState(false)
|
||||||
const [isLoading, setIsLoading] = useState(false)
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
|
@ -43,7 +44,8 @@ export function AddCommentBountyPanel(props: { contract: Contract }) {
|
||||||
<>
|
<>
|
||||||
<div className="mb-4 text-gray-500">
|
<div className="mb-4 text-gray-500">
|
||||||
Add a {formatMoney(amount)} bounty for good comments that the creator
|
Add a {formatMoney(amount)} bounty for good comments that the creator
|
||||||
can award.
|
can award.{' '}
|
||||||
|
{totalAdded > 0 && `(${formatMoney(totalAdded)} currently added)`}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Row className={'items-center gap-2'}>
|
<Row className={'items-center gap-2'}>
|
||||||
|
|
|
@ -50,9 +50,11 @@ export function ContractTabs(props: {
|
||||||
{
|
{
|
||||||
title: `Comments`,
|
title: `Comments`,
|
||||||
tooltip: openCommentBounties
|
tooltip: openCommentBounties
|
||||||
? `The creator of this market will award bounties of ${formatMoney(
|
? `The creator of this market may award ${formatMoney(
|
||||||
COMMENT_BOUNTY_AMOUNT
|
COMMENT_BOUNTY_AMOUNT
|
||||||
)} to good comments`
|
)} for good comments. ${formatMoney(
|
||||||
|
openCommentBounties
|
||||||
|
)} currently available.`
|
||||||
: undefined,
|
: undefined,
|
||||||
content: <CommentsTabContent contract={contract} />,
|
content: <CommentsTabContent contract={contract} />,
|
||||||
inlineTabIcon: <span>({formatMoney(COMMENT_BOUNTY_AMOUNT)})</span>,
|
inlineTabIcon: <span>({formatMoney(COMMENT_BOUNTY_AMOUNT)})</span>,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user