Skip to content

Commit

Permalink
fix comment bets
Browse files Browse the repository at this point in the history
  • Loading branch information
ingawei committed Sep 17, 2024
1 parent ef7c603 commit 0a4ebe5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions common/src/envs/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const SPICE_NAME = 'Prize Point'
export const SWEEPIES_NAME = 'Sweepcash'
export const SPICE_MARKET_TOOLTIP = `Prize market! Earn ${SPICE_NAME}s on resolution`
export const SWEEPIES_MARKET_TOOLTIP = `Sweepstakes market! Win real cash prizes.`
export const CASH_SUFFIX = '--cash'

export const TRADE_TERM = 'trade'
export const TRADED_TERM = 'traded'
Expand Down
8 changes: 5 additions & 3 deletions web/components/comments/comment-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import clsx from 'clsx'
import { Bet } from 'common/bet'
import { ContractComment } from 'common/comment'
import { Contract } from 'common/contract'
import { isAdminId } from 'common/envs/constants'
import { CASH_SUFFIX, isAdminId } from 'common/envs/constants'
import { buildArray } from 'common/util/array'
import { formatPercent, formatWithToken } from 'common/util/format'
import { useState } from 'react'
Expand Down Expand Up @@ -74,11 +74,13 @@ export function FeedCommentHeader(props: {
isRepost,
betOrderAmount,
betLimitProb,
contractSlug,
} = comment

const betOnCashContract = contractSlug.endsWith(CASH_SUFFIX)
const isCashContract = contract.token === 'CASH'
const marketCreator = contract.creatorId === userId
const { bought, money } = getBoughtMoney(betAmount, isCashContract)
const { bought, money } = getBoughtMoney(betAmount, betOnCashContract)
const shouldDisplayOutcome = betOutcome && !answerOutcome
const isReplyToBet = betAmount !== undefined
const commenterIsBettor = commenterAndBettorMatch(comment)
Expand All @@ -104,7 +106,7 @@ export function FeedCommentHeader(props: {
<span className="text-ink-1000">
<MoneyDisplay
amount={betOrderAmount}
isCashContract={isCashContract}
isCashContract={betOnCashContract}
/>
</span>{' '}
<OutcomeLabel
Expand Down

0 comments on commit 0a4ebe5

Please sign in to comment.