Merge branch 'main' into share-row

This commit is contained in:
mantikoros 2022-08-04 22:12:04 -07:00
commit 2e51b42a8a
2 changed files with 15 additions and 90 deletions

View File

@ -1,9 +1,7 @@
import React from 'react'
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 { Spacer } from '../layout/spacer'
import { ContractProbGraph } from './contract-prob-graph'
@ -24,8 +22,6 @@ import { ContractDescription } from './contract-description'
import { ContractDetails } from './contract-details'
import { NumericGraph } from './numeric-graph'
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'
export const ContractOverview = (props: {
@ -41,7 +37,6 @@ export const ContractOverview = (props: {
const isBinary = outcomeType === 'BINARY'
const isPseudoNumeric = outcomeType === 'PSEUDO_NUMERIC'
const showChallenge = user && isBinary && !resolution && CHALLENGES_ENABLED
return (
<Col className={clsx('mb-6', className)}>

View File

@ -119,75 +119,6 @@ function YourLinkSummaryRow(props: { challenge: Challenge }) {
'whitespace-nowrap text-sm hover:cursor-pointer text-gray-500 hover:bg-sky-50 bg-white'
)
return (
<>
<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">
<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={() => {
const qrUrl = `https://api.qrserver.com/v1/create-qr-code/?size=${200}x${200}&data=${getChallengeUrl(
challenge
)}`
window.location.href = qrUrl
}}
>
<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>
<>
<Modal open={open} setOpen={setOpen} size={'sm'}>
<Col
@ -267,7 +198,6 @@ function YourLinkSummaryRow(props: { challenge: Challenge }) {
</td>
</tr>
</>
</>
)
}