Merge branch 'main' into share-row
This commit is contained in:
commit
2e51b42a8a
|
@ -1,9 +1,7 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
import toast from 'react-hot-toast'
|
|
||||||
import { LinkIcon } from '@heroicons/react/outline'
|
|
||||||
|
|
||||||
import { contractUrl, tradingAllowed } from 'web/lib/firebase/contracts'
|
import { tradingAllowed } from 'web/lib/firebase/contracts'
|
||||||
import { Col } from '../layout/col'
|
import { Col } from '../layout/col'
|
||||||
import { Spacer } from '../layout/spacer'
|
import { Spacer } from '../layout/spacer'
|
||||||
import { ContractProbGraph } from './contract-prob-graph'
|
import { ContractProbGraph } from './contract-prob-graph'
|
||||||
|
@ -24,8 +22,6 @@ import { ContractDescription } from './contract-description'
|
||||||
import { ContractDetails } from './contract-details'
|
import { ContractDetails } from './contract-details'
|
||||||
import { NumericGraph } from './numeric-graph'
|
import { NumericGraph } from './numeric-graph'
|
||||||
import { ShareRow } from './share-row'
|
import { ShareRow } from './share-row'
|
||||||
import { CreateChallengeButton } from 'web/components/challenges/create-challenge-button'
|
|
||||||
import { copyToClipboard } from 'web/lib/util/copy'
|
|
||||||
import { CHALLENGES_ENABLED } from 'common/challenge'
|
import { CHALLENGES_ENABLED } from 'common/challenge'
|
||||||
|
|
||||||
export const ContractOverview = (props: {
|
export const ContractOverview = (props: {
|
||||||
|
@ -41,7 +37,6 @@ export const ContractOverview = (props: {
|
||||||
|
|
||||||
const isBinary = outcomeType === 'BINARY'
|
const isBinary = outcomeType === 'BINARY'
|
||||||
const isPseudoNumeric = outcomeType === 'PSEUDO_NUMERIC'
|
const isPseudoNumeric = outcomeType === 'PSEUDO_NUMERIC'
|
||||||
const showChallenge = user && isBinary && !resolution && CHALLENGES_ENABLED
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col className={clsx('mb-6', className)}>
|
<Col className={clsx('mb-6', className)}>
|
||||||
|
|
|
@ -120,6 +120,18 @@ function YourLinkSummaryRow(props: { challenge: Challenge }) {
|
||||||
)
|
)
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<Modal open={open} setOpen={setOpen} size={'sm'}>
|
||||||
|
<Col
|
||||||
|
className={
|
||||||
|
'items-center justify-center gap-4 rounded-md bg-white p-8 py-8 '
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<span className={'mb-4 text-center text-xl text-indigo-700'}>
|
||||||
|
Have your friend scan this to accept the challenge!
|
||||||
|
</span>
|
||||||
|
<QRCode url={getChallengeUrl(challenge)} />
|
||||||
|
</Col>
|
||||||
|
</Modal>
|
||||||
<tr id={challenge.slug} key={challenge.slug} className={className}>
|
<tr id={challenge.slug} key={challenge.slug} className={className}>
|
||||||
<td className={amountClass}>
|
<td className={amountClass}>
|
||||||
<SiteLink href={getChallengeUrl(challenge)}>
|
<SiteLink href={getChallengeUrl(challenge)}>
|
||||||
|
@ -132,7 +144,7 @@ function YourLinkSummaryRow(props: { challenge: Challenge }) {
|
||||||
'text-center sm:max-w-[200px] sm:text-start'
|
'text-center sm:max-w-[200px] sm:text-start'
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<Row className="items-center">
|
<Row className="items-center gap-2">
|
||||||
<Button
|
<Button
|
||||||
color="gray-white"
|
color="gray-white"
|
||||||
size="xs"
|
size="xs"
|
||||||
|
@ -147,10 +159,7 @@ function YourLinkSummaryRow(props: { challenge: Challenge }) {
|
||||||
color="gray-white"
|
color="gray-white"
|
||||||
size="xs"
|
size="xs"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const qrUrl = `https://api.qrserver.com/v1/create-qr-code/?size=${200}x${200}&data=${getChallengeUrl(
|
setOpen(true)
|
||||||
challenge
|
|
||||||
)}`
|
|
||||||
window.location.href = qrUrl
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<QrcodeIcon className="h-5 w-5 sm:h-4 sm:w-4" />
|
<QrcodeIcon className="h-5 w-5 sm:h-4 sm:w-4" />
|
||||||
|
@ -188,85 +197,6 @@ function YourLinkSummaryRow(props: { challenge: Challenge }) {
|
||||||
</Row>
|
</Row>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<>
|
|
||||||
<Modal open={open} setOpen={setOpen} size={'sm'}>
|
|
||||||
<Col
|
|
||||||
className={
|
|
||||||
'items-center justify-center gap-4 rounded-md bg-white p-8 py-8 '
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<span className={'mb-4 text-center text-xl text-indigo-700'}>
|
|
||||||
Have your friend scan this to accept the challenge!
|
|
||||||
</span>
|
|
||||||
<QRCode url={getChallengeUrl(challenge)} />
|
|
||||||
</Col>
|
|
||||||
</Modal>
|
|
||||||
<tr id={challenge.slug} key={challenge.slug} className={className}>
|
|
||||||
<td className={amountClass}>
|
|
||||||
<SiteLink href={getChallengeUrl(challenge)}>
|
|
||||||
{formatMoney(challenge.creatorAmount)}
|
|
||||||
</SiteLink>
|
|
||||||
</td>
|
|
||||||
<td
|
|
||||||
className={clsx(
|
|
||||||
columnClass,
|
|
||||||
'text-center sm:max-w-[200px] sm:text-start'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<Row className="items-center gap-2">
|
|
||||||
<Button
|
|
||||||
color="gray-white"
|
|
||||||
size="xs"
|
|
||||||
onClick={() => {
|
|
||||||
copyToClipboard(getChallengeUrl(challenge))
|
|
||||||
toast('Link copied to clipboard!')
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ClipboardCopyIcon className={'h-5 w-5 sm:h-4 sm:w-4'} />
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
color="gray-white"
|
|
||||||
size="xs"
|
|
||||||
onClick={() => {
|
|
||||||
setOpen(true)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<QrcodeIcon className="h-5 w-5 sm:h-4 sm:w-4" />
|
|
||||||
</Button>
|
|
||||||
<SiteLink
|
|
||||||
href={getChallengeUrl(challenge)}
|
|
||||||
className={'mx-1 mb-1 hidden sm:inline-block'}
|
|
||||||
>
|
|
||||||
{`...${challenge.contractSlug}/${challenge.slug}`}
|
|
||||||
</SiteLink>
|
|
||||||
</Row>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td className={columnClass}>
|
|
||||||
<Row className={'items-center justify-start gap-1'}>
|
|
||||||
{acceptances.length > 0 ? (
|
|
||||||
<>
|
|
||||||
<Avatar
|
|
||||||
username={acceptances[0].userUsername}
|
|
||||||
avatarUrl={acceptances[0].userAvatarUrl}
|
|
||||||
size={'sm'}
|
|
||||||
/>
|
|
||||||
<UserLink
|
|
||||||
name={acceptances[0].userName}
|
|
||||||
username={acceptances[0].userUsername}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<span>
|
|
||||||
No one -
|
|
||||||
{challenge.expiresTime &&
|
|
||||||
` (expires ${fromNow(challenge.expiresTime)})`}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</Row>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</>
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user