Cleanup
This commit is contained in:
parent
b3d265be48
commit
595c3fddd2
|
@ -365,26 +365,24 @@ function BuyPanel(props: {
|
||||||
<Spacer h={8} />
|
<Spacer h={8} />
|
||||||
|
|
||||||
{user && (
|
{user && (
|
||||||
<Col>
|
<button
|
||||||
<button
|
className={clsx(
|
||||||
className={clsx(
|
'btn mb-2 flex-1',
|
||||||
'btn mb-2 flex-1',
|
betDisabled
|
||||||
betDisabled
|
? 'btn-disabled'
|
||||||
? 'btn-disabled'
|
: betChoice === 'YES'
|
||||||
: betChoice === 'YES'
|
? 'btn-primary'
|
||||||
? 'btn-primary'
|
: 'border-none bg-red-400 hover:bg-red-500',
|
||||||
: 'border-none bg-red-400 hover:bg-red-500',
|
isSubmitting ? 'loading' : ''
|
||||||
isSubmitting ? 'loading' : ''
|
)}
|
||||||
)}
|
onClick={betDisabled ? undefined : submitBet}
|
||||||
onClick={betDisabled ? undefined : submitBet}
|
>
|
||||||
>
|
{isSubmitting
|
||||||
{isSubmitting
|
? 'Submitting...'
|
||||||
? 'Submitting...'
|
: isLimitOrder
|
||||||
: isLimitOrder
|
? 'Submit order'
|
||||||
? 'Submit order'
|
: 'Submit bet'}
|
||||||
: 'Submit bet'}
|
</button>
|
||||||
</button>
|
|
||||||
</Col>
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{wasSubmitted && (
|
{wasSubmitted && (
|
||||||
|
@ -401,32 +399,29 @@ function QuickOrLimitBet(props: {
|
||||||
const { isLimitOrder, setIsLimitOrder } = props
|
const { isLimitOrder, setIsLimitOrder } = props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col className="align-center mb-4 justify-between">
|
<Row className="align-center mb-4 justify-between">
|
||||||
<Row>
|
<div className="text-4xl">Bet</div>
|
||||||
<div className="text-4xl">Bet</div>
|
<Row className="mt-1 w-full items-center justify-end gap-0.5">
|
||||||
<Row className="mt-1 w-full items-center justify-end gap-0.5">
|
<PillButton
|
||||||
<PillButton
|
selected={!isLimitOrder}
|
||||||
selected={!isLimitOrder}
|
onSelect={() => {
|
||||||
onSelect={() => {
|
setIsLimitOrder(false)
|
||||||
setIsLimitOrder(false)
|
track('select quick order')
|
||||||
track('select quick order')
|
}}
|
||||||
}}
|
>
|
||||||
>
|
Quick
|
||||||
Quick
|
</PillButton>
|
||||||
</PillButton>
|
<PillButton
|
||||||
<PillButton
|
selected={isLimitOrder}
|
||||||
selected={isLimitOrder}
|
onSelect={() => {
|
||||||
onSelect={() => {
|
setIsLimitOrder(true)
|
||||||
setIsLimitOrder(true)
|
track('select limit order')
|
||||||
track('select limit order')
|
}}
|
||||||
}}
|
>
|
||||||
>
|
Limit
|
||||||
Limit
|
</PillButton>
|
||||||
</PillButton>
|
|
||||||
</Row>
|
|
||||||
</Row>
|
</Row>
|
||||||
<Row className={'mt-2 justify-end'}></Row>
|
</Row>
|
||||||
</Col>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
|
|
||||||
import { SimpleBetPanel } from './bet-panel'
|
import { SimpleBetPanel } from './bet-panel'
|
||||||
|
@ -48,6 +48,7 @@ export default function BetRow(props: {
|
||||||
: ''}
|
: ''}
|
||||||
</div>
|
</div>
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
<Modal open={open} setOpen={setOpen}>
|
<Modal open={open} setOpen={setOpen}>
|
||||||
<SimpleBetPanel
|
<SimpleBetPanel
|
||||||
className={betPanelClassName}
|
className={betPanelClassName}
|
||||||
|
|
|
@ -8,8 +8,8 @@ import { Linkify } from '../linkify'
|
||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
FreeResponseResolutionOrChance,
|
|
||||||
BinaryResolutionOrChance,
|
BinaryResolutionOrChance,
|
||||||
|
FreeResponseResolutionOrChance,
|
||||||
NumericResolutionOrExpectation,
|
NumericResolutionOrExpectation,
|
||||||
PseudoNumericResolutionOrExpectation,
|
PseudoNumericResolutionOrExpectation,
|
||||||
} from './contract-card'
|
} from './contract-card'
|
||||||
|
@ -21,6 +21,8 @@ import { ContractDescription } from './contract-description'
|
||||||
import { ContractDetails } from './contract-details'
|
import { ContractDetails } from './contract-details'
|
||||||
import { ShareMarket } from '../share-market'
|
import { ShareMarket } from '../share-market'
|
||||||
import { NumericGraph } from './numeric-graph'
|
import { NumericGraph } from './numeric-graph'
|
||||||
|
import { CreateChallengeButton } from 'web/components/challenges/create-challenge-button'
|
||||||
|
import React from 'react'
|
||||||
|
|
||||||
export const ContractOverview = (props: {
|
export const ContractOverview = (props: {
|
||||||
contract: Contract
|
contract: Contract
|
||||||
|
@ -116,6 +118,14 @@ export const ContractOverview = (props: {
|
||||||
{outcomeType === 'NUMERIC' && <NumericGraph contract={contract} />}
|
{outcomeType === 'NUMERIC' && <NumericGraph contract={contract} />}
|
||||||
{(contract.description || isCreator) && <Spacer h={6} />}
|
{(contract.description || isCreator) && <Spacer h={6} />}
|
||||||
{isCreator && <ShareMarket className="px-2" contract={contract} />}
|
{isCreator && <ShareMarket className="px-2" contract={contract} />}
|
||||||
|
{user && (
|
||||||
|
<Col>
|
||||||
|
<div>Challenge a friend</div>
|
||||||
|
<Row>
|
||||||
|
<CreateChallengeButton user={user} contract={contract} />
|
||||||
|
</Row>
|
||||||
|
</Col>
|
||||||
|
)}
|
||||||
<ContractDescription
|
<ContractDescription
|
||||||
className="px-2"
|
className="px-2"
|
||||||
contract={contract}
|
contract={contract}
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
import React, { useEffect, useMemo, useState } from 'react'
|
import React, { useEffect, useMemo, useState } from 'react'
|
||||||
import { ArrowLeftIcon } from '@heroicons/react/outline'
|
import { ArrowLeftIcon } from '@heroicons/react/outline'
|
||||||
import { keyBy, sortBy, groupBy, sumBy, mapValues } from 'lodash'
|
import { groupBy, keyBy, mapValues, sortBy, sumBy } from 'lodash'
|
||||||
|
|
||||||
import { useContractWithPreload } from 'web/hooks/use-contract'
|
import { useContractWithPreload } from 'web/hooks/use-contract'
|
||||||
import { ContractOverview } from 'web/components/contract/contract-overview'
|
import { ContractOverview } from 'web/components/contract/contract-overview'
|
||||||
import { BetPanel } from 'web/components/bet-panel'
|
import { BetPanel } from 'web/components/bet-panel'
|
||||||
import { Col } from 'web/components/layout/col'
|
import { Col } from 'web/components/layout/col'
|
||||||
import { useUser } from 'web/hooks/use-user'
|
import { useUser, useUserById } from 'web/hooks/use-user'
|
||||||
import { ResolutionPanel } from 'web/components/resolution-panel'
|
import { ResolutionPanel } from 'web/components/resolution-panel'
|
||||||
import { Title } from 'web/components/title'
|
import { Title } from 'web/components/title'
|
||||||
import { Spacer } from 'web/components/layout/spacer'
|
import { Spacer } from 'web/components/layout/spacer'
|
||||||
import { listUsers, User } from 'web/lib/firebase/users'
|
import { listUsers, User } from 'web/lib/firebase/users'
|
||||||
import {
|
import {
|
||||||
Contract,
|
Contract,
|
||||||
|
getBinaryProbPercent,
|
||||||
getContractFromSlug,
|
getContractFromSlug,
|
||||||
tradingAllowed,
|
tradingAllowed,
|
||||||
getBinaryProbPercent,
|
|
||||||
} from 'web/lib/firebase/contracts'
|
} from 'web/lib/firebase/contracts'
|
||||||
import { SEO } from 'web/components/SEO'
|
import { SEO } from 'web/components/SEO'
|
||||||
import { Page } from 'web/components/page'
|
import { Page } from 'web/components/page'
|
||||||
|
@ -27,7 +27,6 @@ import { fromPropz, usePropz } from 'web/hooks/use-propz'
|
||||||
import { Leaderboard } from 'web/components/leaderboard'
|
import { Leaderboard } from 'web/components/leaderboard'
|
||||||
import { resolvedPayout } from 'common/calculate'
|
import { resolvedPayout } from 'common/calculate'
|
||||||
import { formatMoney } from 'common/util/format'
|
import { formatMoney } from 'common/util/format'
|
||||||
import { useUserById } from 'web/hooks/use-user'
|
|
||||||
import { ContractTabs } from 'web/components/contract/contract-tabs'
|
import { ContractTabs } from 'web/components/contract/contract-tabs'
|
||||||
import { contractTextDetails } from 'web/components/contract/contract-details'
|
import { contractTextDetails } from 'web/components/contract/contract-details'
|
||||||
import { useWindowSize } from 'web/hooks/use-window-size'
|
import { useWindowSize } from 'web/hooks/use-window-size'
|
||||||
|
@ -168,12 +167,10 @@ export function ContractPageContent(
|
||||||
(isNumeric ? (
|
(isNumeric ? (
|
||||||
<NumericBetPanel className="hidden xl:flex" contract={contract} />
|
<NumericBetPanel className="hidden xl:flex" contract={contract} />
|
||||||
) : (
|
) : (
|
||||||
<div>
|
<BetPanel
|
||||||
<BetPanel
|
className="hidden xl:flex"
|
||||||
className="hidden xl:flex"
|
contract={contract as CPMMBinaryContract}
|
||||||
contract={contract as CPMMBinaryContract}
|
/>
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
))}
|
))}
|
||||||
{allowResolve &&
|
{allowResolve &&
|
||||||
(isNumeric || isPseudoNumeric ? (
|
(isNumeric || isPseudoNumeric ? (
|
||||||
|
|
|
@ -7,9 +7,8 @@ import { Row } from 'web/components/layout/row'
|
||||||
import { Page } from 'web/components/page'
|
import { Page } from 'web/components/page'
|
||||||
import { SEO } from 'web/components/SEO'
|
import { SEO } from 'web/components/SEO'
|
||||||
import { Title } from 'web/components/title'
|
import { Title } from 'web/components/title'
|
||||||
import { useUser } from 'web/hooks/use-user'
|
import { useUser, useUserById } from 'web/hooks/use-user'
|
||||||
import { fromNow } from 'web/lib/util/time'
|
import { fromNow } from 'web/lib/util/time'
|
||||||
import { useUserById } from 'web/hooks/use-user'
|
|
||||||
|
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import customParseFormat from 'dayjs/plugin/customParseFormat'
|
import customParseFormat from 'dayjs/plugin/customParseFormat'
|
||||||
|
@ -18,13 +17,14 @@ import {
|
||||||
useAcceptedChallenges,
|
useAcceptedChallenges,
|
||||||
useUserChallenges,
|
useUserChallenges,
|
||||||
} from 'web/lib/firebase/challenges'
|
} from 'web/lib/firebase/challenges'
|
||||||
import { Challenge, Acceptance } from 'common/challenge'
|
import { Acceptance, Challenge } from 'common/challenge'
|
||||||
import { copyToClipboard } from 'web/lib/util/copy'
|
import { copyToClipboard } from 'web/lib/util/copy'
|
||||||
import { ToastClipboard } from 'web/components/toast-clipboard'
|
import { ToastClipboard } from 'web/components/toast-clipboard'
|
||||||
import { Tabs } from 'web/components/layout/tabs'
|
import { Tabs } from 'web/components/layout/tabs'
|
||||||
import { SiteLink } from 'web/components/site-link'
|
import { SiteLink } from 'web/components/site-link'
|
||||||
import { UserLink } from 'web/components/user-page'
|
import { UserLink } from 'web/components/user-page'
|
||||||
import { Avatar } from 'web/components/avatar'
|
import { Avatar } from 'web/components/avatar'
|
||||||
|
|
||||||
dayjs.extend(customParseFormat)
|
dayjs.extend(customParseFormat)
|
||||||
|
|
||||||
export function getManalinkUrl(slug: string) {
|
export function getManalinkUrl(slug: string) {
|
||||||
|
@ -72,54 +72,6 @@ export default function LinkPage() {
|
||||||
</Page>
|
</Page>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// export function ClaimsList(props: { txns: ManalinkTxn[] }) {
|
|
||||||
// const { txns } = props
|
|
||||||
// return (
|
|
||||||
// <>
|
|
||||||
// <h1 className="mb-4 text-xl font-semibold text-gray-900">
|
|
||||||
// Claimed links
|
|
||||||
// </h1>
|
|
||||||
// {txns.map((txn) => (
|
|
||||||
// <ClaimDescription txn={txn} key={txn.id} />
|
|
||||||
// ))}
|
|
||||||
// </>
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
|
|
||||||
// export function ClaimDescription(props: { txn: ManalinkTxn }) {
|
|
||||||
// const { txn } = props
|
|
||||||
// const from = useUserById(txn.fromId)
|
|
||||||
// const to = useUserById(txn.toId)
|
|
||||||
//
|
|
||||||
// if (!from || !to) {
|
|
||||||
// return <>Loading...</>
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return (
|
|
||||||
// <div className="mb-2 flow-root pr-2 md:pr-0">
|
|
||||||
// <div className="relative flex items-center space-x-3">
|
|
||||||
// <Avatar username={to.name} avatarUrl={to.avatarUrl} size="sm" />
|
|
||||||
// <div className="min-w-0 flex-1">
|
|
||||||
// <p className="mt-0.5 text-sm text-gray-500">
|
|
||||||
// <UserLink
|
|
||||||
// className="text-gray-500"
|
|
||||||
// username={to.username}
|
|
||||||
// name={to.name}
|
|
||||||
// />{' '}
|
|
||||||
// claimed {formatMoney(txn.amount)} from{' '}
|
|
||||||
// <UserLink
|
|
||||||
// className="text-gray-500"
|
|
||||||
// username={from.username}
|
|
||||||
// name={from.name}
|
|
||||||
// />
|
|
||||||
// <RelativeTimestamp time={txn.createdTime} />
|
|
||||||
// </p>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
|
|
||||||
function ClaimTableRow(props: { claim: Acceptance }) {
|
function ClaimTableRow(props: { claim: Acceptance }) {
|
||||||
const { claim } = props
|
const { claim } = props
|
||||||
|
|
|
@ -21,8 +21,11 @@ import { useMeasureSize } from 'web/hooks/use-measure-size'
|
||||||
import { fromPropz, usePropz } from 'web/hooks/use-propz'
|
import { fromPropz, usePropz } from 'web/hooks/use-propz'
|
||||||
import { useWindowSize } from 'web/hooks/use-window-size'
|
import { useWindowSize } from 'web/hooks/use-window-size'
|
||||||
import { listAllBets } from 'web/lib/firebase/bets'
|
import { listAllBets } from 'web/lib/firebase/bets'
|
||||||
import { contractPath, getContractFromSlug } from 'web/lib/firebase/contracts'
|
import {
|
||||||
import { tradingAllowed } from 'web/lib/firebase/contracts'
|
contractPath,
|
||||||
|
getContractFromSlug,
|
||||||
|
tradingAllowed,
|
||||||
|
} from 'web/lib/firebase/contracts'
|
||||||
import Custom404 from '../../404'
|
import Custom404 from '../../404'
|
||||||
|
|
||||||
export const getStaticProps = fromPropz(getStaticPropz)
|
export const getStaticProps = fromPropz(getStaticPropz)
|
||||||
|
@ -76,12 +79,8 @@ export default function ContractEmbedPage(props: {
|
||||||
return <ContractEmbed contract={contract} bets={bets} />
|
return <ContractEmbed contract={contract} bets={bets} />
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ContractEmbed(props: {
|
export function ContractEmbed(props: { contract: Contract; bets: Bet[] }) {
|
||||||
contract: Contract
|
const { contract, bets } = props
|
||||||
bets: Bet[]
|
|
||||||
height?: number
|
|
||||||
}) {
|
|
||||||
const { contract, bets, height } = props
|
|
||||||
const { question, outcomeType } = contract
|
const { question, outcomeType } = contract
|
||||||
|
|
||||||
const isBinary = outcomeType === 'BINARY'
|
const isBinary = outcomeType === 'BINARY'
|
||||||
|
@ -93,11 +92,10 @@ export function ContractEmbed(props: {
|
||||||
const { setElem, height: topSectionHeight } = useMeasureSize()
|
const { setElem, height: topSectionHeight } = useMeasureSize()
|
||||||
const paddingBottom = 8
|
const paddingBottom = 8
|
||||||
|
|
||||||
const graphHeight = !height
|
const graphHeight =
|
||||||
? windowHeight && topSectionHeight
|
windowHeight && topSectionHeight
|
||||||
? windowHeight - topSectionHeight - paddingBottom
|
? windowHeight - topSectionHeight - paddingBottom
|
||||||
: 0
|
: 0
|
||||||
: height
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col className="w-full flex-1 bg-white">
|
<Col className="w-full flex-1 bg-white">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user