diff --git a/web/components/challenges/create-challenge-button.tsx b/web/components/challenges/create-challenge-button.tsx index e406dabf..d3490ff8 100644 --- a/web/components/challenges/create-challenge-button.tsx +++ b/web/components/challenges/create-challenge-button.tsx @@ -10,7 +10,6 @@ import { Button } from '../button' import { DuplicateIcon } from '@heroicons/react/outline' import { createChallenge, getChallengeUrl } from 'web/lib/firebase/challenges' import { Contract } from 'common/contract' -import { track } from 'web/lib/service/analytics' import { CopyLinkButton } from 'web/components/copy-link-button' import { getOutcomeProbability } from 'common/lib/calculate' import { SiteLink } from 'web/components/site-link' @@ -78,9 +77,7 @@ function CreateChallengeForm(props: { const { user, onCreate, contract, highlightedSlug } = props const [isCreating, setIsCreating] = useState(false) const [finishedCreating, setFinishedCreating] = useState(false) - const [copyPressed, setCopyPressed] = useState(false) const [error, setError] = useState('') - setTimeout(() => setCopyPressed(false), 300) const defaultExpire = 'week' const isBinary = contract.outcomeType === 'BINARY' const isNumeric = contract.outcomeType === 'PSEUDO_NUMERIC' @@ -241,28 +238,16 @@ function CreateChallengeForm(props: { {finishedCreating && ( <> - <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 - link={highlightedSlug} - onCopy={() => { - setCopyPressed(true) - track('copy share challenge') - }} - buttonClassName="btn-sm rounded-l-none" - toastClassName={'-left-40 -top-20 mt-1'} - icon={DuplicateIcon} - label={''} - /> - </Row> + <CopyLinkButton + url={highlightedSlug} + buttonClassName="btn-md rounded-l-none" + displayUrl={ + '...challenges/' + highlightedSlug.split('/challenges/')[1] + } + toastClassName={'-left-40 -top-20 mt-1'} + icon={DuplicateIcon} + /> <Row className={'gap-1'}> See your other <SiteLink className={'font-bold'} href={'/challenges'}> diff --git a/web/components/copy-link-button.tsx b/web/components/copy-link-button.tsx index fbd998d1..f3489f3d 100644 --- a/web/components/copy-link-button.tsx +++ b/web/components/copy-link-button.tsx @@ -1,4 +1,4 @@ -import React, { Fragment, useEffect } from 'react' +import React, { Fragment } from 'react' import { LinkIcon } from '@heroicons/react/outline' import { Menu, Transition } from '@headlessui/react' import clsx from 'clsx' diff --git a/web/components/share-market.tsx b/web/components/share-market.tsx index 8c867213..7e036188 100644 --- a/web/components/share-market.tsx +++ b/web/components/share-market.tsx @@ -4,9 +4,6 @@ import { Contract, contractPath, contractUrl } from 'web/lib/firebase/contracts' import { CopyLinkButton } from './copy-link-button' import { Col } from './layout/col' 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 }) { const { contract, className } = props