1e66f4d140
* Challenge bets
* Store avatar url
* Fix before and after probs
* Check balance before creation
* Calculate winning shares
* pretty
* Change winning value
* Set shares to equal each other
* Fix share challenge link
* pretty
* remove lib refs
* Probability of bet is set to market
* Remove peer pill
* Cleanup
* Button on contract page
* don't show challenge if not binary or if resolved
* challenge button (WIP)
* fix accept challenge: don't change pool/probability
* Opengraph preview [WIP]
* elim lib
* Edit og card props
* Change challenge text
* New card gen attempt
* Get challenge on server
* challenge button styling
* Use env domain
* Remove other window ref
* Use challenge creator as avatar
* Remove user name
* Remove s from property, replace prob with outcome
* challenge form
* share text
* Add in challenge parts to template and url
* Challenge url params optional
* Add challenge params to parse request
* Parse please
* Don't remove prob
* Challenge card styling
* Challenge card styling
* Challenge card styling
* Challenge card styling
* Challenge card styling
* Challenge card styling
* Challenge card styling
* Challenge card styling
* Add to readme about how to dev og-image
* Add emojis
* button: gradient background, 2xl size
* beautify accept bet screen
* update question button
* Add separate challenge template
* Accepted challenge sharing card, fix accept bet call
* accept challenge button
* challenge winner page
* create challenge screen
* Your outcome/cost=> acceptorOutcome/cost
* New create challenge panel
* Fix main merge
* Add challenge slug to bet and filter by it
* Center title
* Add helper text
* Add FAQ section
* Lint
* Columnize the user areas in preview link too
* Absolutely position
* Spacing
* Orientation
* Restyle challenges list, cache contract name
* Make copying easy on mobile
* Link spacing
* Fix spacing
* qr codes!
* put your challenges first
* eslint
* Changes to contract buttons and create challenge modal
* Change titles around for current bet
* Add back in contract title after winning
* Cleanup
* Add challenge enabled flag
* Spacing of switch button
* market share row
* Add lite market endpoint
* 500 mana email (#687)
* Create 500-mana.html
* Update 500-mana.html
Fixed typos and links not working
* Added "create a good market" guide
added page creating-market.html
For Stephen to set up condition (email 3 days after signing up)
* Update 500-mana.html
updated 500 Mana email (still need to make changes to create market guide)
* email changes
* sendOneWeekBonusEmail logic
* add dayjs as dependency
* don't use mailgun scheduling
Co-authored-by: mantikoros <sgrugett@gmail.com>
* Challenge Bets (#679)
* Challenge bets
* Store avatar url
* Fix before and after probs
* Check balance before creation
* Calculate winning shares
* pretty
* Change winning value
* Set shares to equal each other
* Fix share challenge link
* pretty
* remove lib refs
* Probability of bet is set to market
* Remove peer pill
* Cleanup
* Button on contract page
* don't show challenge if not binary or if resolved
* challenge button (WIP)
* fix accept challenge: don't change pool/probability
* Opengraph preview [WIP]
* elim lib
* Edit og card props
* Change challenge text
* New card gen attempt
* Get challenge on server
* challenge button styling
* Use env domain
* Remove other window ref
* Use challenge creator as avatar
* Remove user name
* Remove s from property, replace prob with outcome
* challenge form
* share text
* Add in challenge parts to template and url
* Challenge url params optional
* Add challenge params to parse request
* Parse please
* Don't remove prob
* Challenge card styling
* Challenge card styling
* Challenge card styling
* Challenge card styling
* Challenge card styling
* Challenge card styling
* Challenge card styling
* Challenge card styling
* Add to readme about how to dev og-image
* Add emojis
* button: gradient background, 2xl size
* beautify accept bet screen
* update question button
* Add separate challenge template
* Accepted challenge sharing card, fix accept bet call
* accept challenge button
* challenge winner page
* create challenge screen
* Your outcome/cost=> acceptorOutcome/cost
* New create challenge panel
* Fix main merge
* Add challenge slug to bet and filter by it
* Center title
* Add helper text
* Add FAQ section
* Lint
* Columnize the user areas in preview link too
* Absolutely position
* Spacing
* Orientation
* Restyle challenges list, cache contract name
* Make copying easy on mobile
* Link spacing
* Fix spacing
* qr codes!
* put your challenges first
* eslint
* Changes to contract buttons and create challenge modal
* Change titles around for current bet
* Add back in contract title after winning
* Cleanup
* Add challenge enabled flag
* Spacing of switch button
* Put sharing qr code in modal
Co-authored-by: mantikoros <sgrugett@gmail.com>
* See challenges you've accepted too
* Remove max height
* Notify mentioned users on market publish (#683)
* Add function to parse at mentions
* Notify mentioned users on market create
- refactor createNotification to accept list of recipients' ids
* Switch comments/chat to rich text editor (#703)
* Switch comments/chat to rich text editor
* Remove TruncatedComment
* Re-add submit on enter
* Insert at mention on reply
* Update editor style for send button
* only submit on enter in chat
* code review: refactor
* use more specific type for upload
* fix ESlint and errors from merge
* fix trigger on every render eslint warning
* Notify people mentioned in comment
* fix type errors
* Revert "Switch comments/chat to rich text editor (#703)"
This reverts commit f52da72115
.
* merge conflict
* share modal
* merge issue
* eslint
* bigger link icion
Co-authored-by: Ian Philips <iansphilips@gmail.com>
Co-authored-by: James Grugett <jahooma@gmail.com>
Co-authored-by: SirSaltyy <104849031+SirSaltyy@users.noreply.github.com>
Co-authored-by: Sinclair Chen <abc.sinclair@gmail.com>
135 lines
3.9 KiB
TypeScript
135 lines
3.9 KiB
TypeScript
import { DotsHorizontalIcon } from '@heroicons/react/outline'
|
|
import clsx from 'clsx'
|
|
import dayjs from 'dayjs'
|
|
import { uniqBy } from 'lodash'
|
|
import { useState } from 'react'
|
|
import { Bet } from 'common/bet'
|
|
|
|
import { Contract } from 'common/contract'
|
|
import { formatMoney } from 'common/util/format'
|
|
import { contractPool } from 'web/lib/firebase/contracts'
|
|
import { LiquidityPanel } from '../liquidity-panel'
|
|
import { Col } from '../layout/col'
|
|
import { Modal } from '../layout/modal'
|
|
import { Title } from '../title'
|
|
import { InfoTooltip } from '../info-tooltip'
|
|
|
|
export const contractDetailsButtonClassName =
|
|
'group flex items-center rounded-md px-3 py-2 text-sm font-medium cursor-pointer hover:bg-gray-100 text-gray-400 hover:text-gray-500'
|
|
|
|
export function ContractInfoDialog(props: { contract: Contract; bets: Bet[] }) {
|
|
const { contract, bets } = props
|
|
|
|
const [open, setOpen] = useState(false)
|
|
|
|
const formatTime = (dt: number) => dayjs(dt).format('MMM DD, YYYY hh:mm a z')
|
|
|
|
const { createdTime, closeTime, resolutionTime, mechanism, outcomeType } =
|
|
contract
|
|
|
|
const tradersCount = uniqBy(
|
|
bets.filter((bet) => !bet.isAnte),
|
|
'userId'
|
|
).length
|
|
|
|
const typeDisplay =
|
|
outcomeType === 'BINARY'
|
|
? 'YES / NO'
|
|
: outcomeType === 'FREE_RESPONSE'
|
|
? 'Free response'
|
|
: outcomeType === 'MULTIPLE_CHOICE'
|
|
? 'Multiple choice'
|
|
: 'Numeric'
|
|
|
|
return (
|
|
<>
|
|
<button
|
|
className={contractDetailsButtonClassName}
|
|
onClick={() => setOpen(true)}
|
|
>
|
|
<DotsHorizontalIcon
|
|
className={clsx('h-6 w-6 flex-shrink-0')}
|
|
aria-hidden="true"
|
|
/>
|
|
</button>
|
|
|
|
<Modal open={open} setOpen={setOpen}>
|
|
<Col className="gap-4 rounded bg-white p-6">
|
|
<Title className="!mt-0 !mb-0" text="Market info" />
|
|
|
|
<table className="table-compact table-zebra table w-full text-gray-500">
|
|
<tbody>
|
|
<tr>
|
|
<td>Type</td>
|
|
<td>{typeDisplay}</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>Payout</td>
|
|
<td>
|
|
{mechanism === 'cpmm-1' ? (
|
|
<>
|
|
Fixed{' '}
|
|
<InfoTooltip text="Each YES share is worth M$1 if YES wins." />
|
|
</>
|
|
) : (
|
|
<div>
|
|
Parimutuel{' '}
|
|
<InfoTooltip text="Each share is a fraction of the pool. " />
|
|
</div>
|
|
)}
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>Market created</td>
|
|
<td>{formatTime(createdTime)}</td>
|
|
</tr>
|
|
|
|
{closeTime && (
|
|
<tr>
|
|
<td>Market close{closeTime > Date.now() ? 's' : 'd'}</td>
|
|
<td>{formatTime(closeTime)}</td>
|
|
</tr>
|
|
)}
|
|
|
|
{resolutionTime && (
|
|
<tr>
|
|
<td>Market resolved</td>
|
|
<td>{formatTime(resolutionTime)}</td>
|
|
</tr>
|
|
)}
|
|
|
|
<tr>
|
|
<td>Volume</td>
|
|
<td>{formatMoney(contract.volume)}</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>Creator earnings</td>
|
|
<td>{formatMoney(contract.collectedFees.creatorFee)}</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>Traders</td>
|
|
<td>{tradersCount}</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>
|
|
{mechanism === 'cpmm-1' ? 'Liquidity pool' : 'Betting pool'}
|
|
</td>
|
|
<td>{contractPool(contract)}</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
{contract.mechanism === 'cpmm-1' && !contract.resolution && (
|
|
<LiquidityPanel contract={contract} />
|
|
)}
|
|
</Col>
|
|
</Modal>
|
|
</>
|
|
)
|
|
}
|