rename MKT to PROB; show resolved probability; move format utilities to common
This commit is contained in:
parent
967ac1b08d
commit
4ad5485988
|
@ -1,5 +1,7 @@
|
|||
import { getProbability } from '../../common/calculate'
|
||||
import { Contract } from '../../common/contract'
|
||||
import { User } from '../../common/user'
|
||||
import { formatPercent } from '../../common/util/format'
|
||||
import { sendTemplateEmail } from './send-email'
|
||||
import { getPrivateUser, getUser } from './utils'
|
||||
|
||||
|
@ -31,7 +33,8 @@ export const sendMarketResolutionEmail = async (
|
|||
const user = await getUser(userId)
|
||||
if (!user) return
|
||||
|
||||
const outcome = toDisplayResolution[resolution]
|
||||
const prob = formatPercent(getProbability(contract.totalShares))
|
||||
const outcome = toDisplayResolution[resolution].replace('PROB', prob)
|
||||
|
||||
const subject = `Resolved ${outcome}: ${contract.question}`
|
||||
|
||||
|
@ -57,4 +60,4 @@ export const sendMarketResolutionEmail = async (
|
|||
)
|
||||
}
|
||||
|
||||
const toDisplayResolution = { YES: 'YES', NO: 'NO', CANCEL: 'N/A', MKT: 'MKT' }
|
||||
const toDisplayResolution = { YES: 'YES', NO: 'NO', CANCEL: 'N/A', MKT: 'PROB' }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import clsx from 'clsx'
|
||||
import { useUser } from '../hooks/use-user'
|
||||
import { formatMoney } from '../lib/util/format'
|
||||
import { formatMoney } from '../../common/util/format'
|
||||
import { AddFundsButton } from './add-funds-button'
|
||||
import { Col } from './layout/col'
|
||||
import { Row } from './layout/row'
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
formatMoney,
|
||||
formatPercent,
|
||||
formatWithCommas,
|
||||
} from '../lib/util/format'
|
||||
} from '../../common/util/format'
|
||||
import { Title } from './title'
|
||||
import {
|
||||
getProbability,
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
formatMoney,
|
||||
formatPercent,
|
||||
formatWithCommas,
|
||||
} from '../lib/util/format'
|
||||
} from '../../common/util/format'
|
||||
import { Col } from './layout/col'
|
||||
import { Spacer } from './layout/spacer'
|
||||
import {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import clsx from 'clsx'
|
||||
import Link from 'next/link'
|
||||
import { Row } from '../components/layout/row'
|
||||
import { formatMoney } from '../lib/util/format'
|
||||
import { formatMoney } from '../../common/util/format'
|
||||
import { UserLink } from './user-page'
|
||||
import {
|
||||
Contract,
|
||||
|
@ -74,7 +74,7 @@ export function ResolutionOrChance(props: {
|
|||
const resolutionText = {
|
||||
YES: 'YES',
|
||||
NO: 'NO',
|
||||
MKT: 'MKT',
|
||||
MKT: probPercent,
|
||||
CANCEL: 'N/A',
|
||||
'': '',
|
||||
}[resolution || '']
|
||||
|
|
|
@ -27,7 +27,7 @@ import { Linkify } from './linkify'
|
|||
import { Row } from './layout/row'
|
||||
import { createComment } from '../lib/firebase/comments'
|
||||
import { useComments } from '../hooks/use-comments'
|
||||
import { formatMoney } from '../lib/util/format'
|
||||
import { formatMoney } from '../../common/util/format'
|
||||
import { ResolutionOrChance } from './contract-card'
|
||||
import { SiteLink } from './site-link'
|
||||
import { Col } from './layout/col'
|
||||
|
|
|
@ -4,7 +4,7 @@ import { useState } from 'react'
|
|||
import { parseWordsAsTags } from '../../common/util/parse'
|
||||
import { createFold } from '../lib/firebase/api-call'
|
||||
import { foldPath } from '../lib/firebase/folds'
|
||||
import { toCamelCase } from '../lib/util/format'
|
||||
import { toCamelCase } from '../../common/util/format'
|
||||
import { ConfirmationButton } from './confirmation-button'
|
||||
import { Col } from './layout/col'
|
||||
import { Spacer } from './layout/spacer'
|
||||
|
|
|
@ -6,7 +6,7 @@ import { PencilIcon } from '@heroicons/react/outline'
|
|||
import { Fold } from '../../common/fold'
|
||||
import { parseWordsAsTags } from '../../common/util/parse'
|
||||
import { deleteFold, updateFold } from '../lib/firebase/folds'
|
||||
import { toCamelCase } from '../lib/util/format'
|
||||
import { toCamelCase } from '../../common/util/format'
|
||||
import { Spacer } from './layout/spacer'
|
||||
import { TagsList } from './tags-list'
|
||||
import { useRouter } from 'next/router'
|
||||
|
|
|
@ -22,5 +22,5 @@ export function CancelLabel() {
|
|||
}
|
||||
|
||||
export function MarketLabel() {
|
||||
return <span className="text-blue-400">MKT</span>
|
||||
return <span className="text-blue-400">PROB</span>
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { firebaseLogout, User } from '../lib/firebase/users'
|
||||
import { formatMoney } from '../lib/util/format'
|
||||
import { formatMoney } from '../../common/util/format'
|
||||
import { Avatar } from './avatar'
|
||||
import { Col } from './layout/col'
|
||||
import { MenuButton } from './menu'
|
||||
|
|
|
@ -82,8 +82,8 @@ export function ResolutionPanel(props: {
|
|||
<>The pool will be returned to traders with no fees.</>
|
||||
) : outcome === 'MKT' ? (
|
||||
<>
|
||||
Traders will be paid out at the current implied probability. You
|
||||
earn 1% of the pool.
|
||||
Traders will be paid out at the probability you specify. You earn 1%
|
||||
of the pool.
|
||||
</>
|
||||
) : (
|
||||
<>Resolving this market will immediately pay out traders.</>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import clsx from 'clsx'
|
||||
import React from 'react'
|
||||
import { formatMoney } from '../lib/util/format'
|
||||
import { formatMoney } from '../../common/util/format'
|
||||
import { Col } from './layout/col'
|
||||
import { Row } from './layout/row'
|
||||
|
||||
|
@ -78,7 +78,7 @@ export function YesNoCancelSelector(props: {
|
|||
onClick={() => onSelect('MKT')}
|
||||
className={clsx(btnClassName, 'btn-sm')}
|
||||
>
|
||||
MKT
|
||||
PROB
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
|
|
|
@ -28,7 +28,7 @@ import { useRouter } from 'next/router'
|
|||
import clsx from 'clsx'
|
||||
import { scoreCreators, scoreTraders } from '../../../lib/firebase/scoring'
|
||||
import { Leaderboard } from '../../../components/leaderboard'
|
||||
import { formatMoney, toCamelCase } from '../../../lib/util/format'
|
||||
import { formatMoney, toCamelCase } from '../../../../common/util/format'
|
||||
import { EditFoldButton } from '../../../components/edit-fold-button'
|
||||
import Custom404 from '../../404'
|
||||
import { FollowFoldButton } from '../../../components/follow-fold-button'
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import _ from 'lodash'
|
||||
|
||||
import { Col } from '../components/layout/col'
|
||||
import { Leaderboard } from '../components/leaderboard'
|
||||
import { Page } from '../components/page'
|
||||
import { getTopCreators, getTopTraders, User } from '../lib/firebase/users'
|
||||
import { formatMoney } from '../lib/util/format'
|
||||
import { formatMoney } from '../../common/util/format'
|
||||
|
||||
export async function getStaticProps() {
|
||||
const [topTraders, topCreators] = await Promise.all([
|
||||
|
|
Loading…
Reference in New Issue
Block a user