Fix share challenge link
This commit is contained in:
parent
87df5a0783
commit
fbd1bb21be
|
@ -10,7 +10,6 @@ import { Button } from '../button'
|
||||||
import { DuplicateIcon } from '@heroicons/react/outline'
|
import { DuplicateIcon } from '@heroicons/react/outline'
|
||||||
import { createChallenge, getChallengeUrl } from 'web/lib/firebase/challenges'
|
import { createChallenge, getChallengeUrl } from 'web/lib/firebase/challenges'
|
||||||
import { Contract } from 'common/contract'
|
import { Contract } from 'common/contract'
|
||||||
import { track } from 'web/lib/service/analytics'
|
|
||||||
import { CopyLinkButton } from 'web/components/copy-link-button'
|
import { CopyLinkButton } from 'web/components/copy-link-button'
|
||||||
import { getOutcomeProbability } from 'common/lib/calculate'
|
import { getOutcomeProbability } from 'common/lib/calculate'
|
||||||
import { SiteLink } from 'web/components/site-link'
|
import { SiteLink } from 'web/components/site-link'
|
||||||
|
@ -78,9 +77,7 @@ function CreateChallengeForm(props: {
|
||||||
const { user, onCreate, contract, highlightedSlug } = props
|
const { user, onCreate, contract, highlightedSlug } = props
|
||||||
const [isCreating, setIsCreating] = useState(false)
|
const [isCreating, setIsCreating] = useState(false)
|
||||||
const [finishedCreating, setFinishedCreating] = useState(false)
|
const [finishedCreating, setFinishedCreating] = useState(false)
|
||||||
const [copyPressed, setCopyPressed] = useState(false)
|
|
||||||
const [error, setError] = useState<string>('')
|
const [error, setError] = useState<string>('')
|
||||||
setTimeout(() => setCopyPressed(false), 300)
|
|
||||||
const defaultExpire = 'week'
|
const defaultExpire = 'week'
|
||||||
const isBinary = contract.outcomeType === 'BINARY'
|
const isBinary = contract.outcomeType === 'BINARY'
|
||||||
const isNumeric = contract.outcomeType === 'PSEUDO_NUMERIC'
|
const isNumeric = contract.outcomeType === 'PSEUDO_NUMERIC'
|
||||||
|
@ -241,28 +238,16 @@ function CreateChallengeForm(props: {
|
||||||
{finishedCreating && (
|
{finishedCreating && (
|
||||||
<>
|
<>
|
||||||
<Title className="!my-0" text="Challenge Created!" />
|
<Title className="!my-0" text="Challenge Created!" />
|
||||||
<Row
|
|
||||||
className={clsx(
|
|
||||||
'rounded border bg-gray-50 py-2 px-3 text-sm text-gray-500 transition-colors duration-700',
|
|
||||||
copyPressed ? 'bg-indigo-50 text-indigo-500 transition-none' : ''
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<div className="flex w-full select-text items-center truncate">
|
|
||||||
{highlightedSlug}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<CopyLinkButton
|
<CopyLinkButton
|
||||||
link={highlightedSlug}
|
url={highlightedSlug}
|
||||||
onCopy={() => {
|
buttonClassName="btn-md rounded-l-none"
|
||||||
setCopyPressed(true)
|
displayUrl={
|
||||||
track('copy share challenge')
|
'...challenges/' + highlightedSlug.split('/challenges/')[1]
|
||||||
}}
|
}
|
||||||
buttonClassName="btn-sm rounded-l-none"
|
toastClassName={'-left-40 -top-20 mt-1'}
|
||||||
toastClassName={'-left-40 -top-20 mt-1'}
|
icon={DuplicateIcon}
|
||||||
icon={DuplicateIcon}
|
/>
|
||||||
label={''}
|
|
||||||
/>
|
|
||||||
</Row>
|
|
||||||
<Row className={'gap-1'}>
|
<Row className={'gap-1'}>
|
||||||
See your other
|
See your other
|
||||||
<SiteLink className={'font-bold'} href={'/challenges'}>
|
<SiteLink className={'font-bold'} href={'/challenges'}>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { Fragment, useEffect } from 'react'
|
import React, { Fragment } from 'react'
|
||||||
import { LinkIcon } from '@heroicons/react/outline'
|
import { LinkIcon } from '@heroicons/react/outline'
|
||||||
import { Menu, Transition } from '@headlessui/react'
|
import { Menu, Transition } from '@headlessui/react'
|
||||||
import clsx from 'clsx'
|
import clsx from 'clsx'
|
||||||
|
|
|
@ -4,9 +4,6 @@ import { Contract, contractPath, contractUrl } from 'web/lib/firebase/contracts'
|
||||||
import { CopyLinkButton } from './copy-link-button'
|
import { CopyLinkButton } from './copy-link-button'
|
||||||
import { Col } from './layout/col'
|
import { Col } from './layout/col'
|
||||||
import { Row } from './layout/row'
|
import { Row } from './layout/row'
|
||||||
import { copyToClipboard } from 'web/lib/util/copy'
|
|
||||||
import { ENV_CONFIG } from 'common/lib/envs/constants'
|
|
||||||
import { track } from 'web/lib/service/analytics'
|
|
||||||
|
|
||||||
export function ShareMarket(props: { contract: Contract; className?: string }) {
|
export function ShareMarket(props: { contract: Contract; className?: string }) {
|
||||||
const { contract, className } = props
|
const { contract, className } = props
|
||||||
|
|
Loading…
Reference in New Issue
Block a user