import { LinkIcon } from '@heroicons/react/outline' import clsx from 'clsx' import toast from 'react-hot-toast' import { Row } from '../layout/row' import { Contract, contractPath } from 'web/lib/firebase/contracts' import { useState } from 'react' import { ENV_CONFIG } from 'common/envs/constants' import { Button } from 'web/components/button' import { copyToClipboard } from 'web/lib/util/copy' import { track } from 'web/lib/service/analytics' import { CreateChallengeModal } from '../challenges/create-challenge-modal' import { User } from 'common/user' import { CHALLENGES_ENABLED } from 'common/challenge' export function ShareRow(props: { contract: Contract user: User | undefined | null }) { const { user, contract } = props const { outcomeType, resolution } = contract const showChallenge = user && outcomeType === 'BINARY' && !resolution && CHALLENGES_ENABLED const copyPayload = `https://${ENV_CONFIG.domain}${contractPath(contract)}${ user?.username && contract.creatorUsername !== user?.username ? '?referrer=' + user?.username : '' }` const linkIcon = (