Copy contract url doesn't use current url

This commit is contained in:
James Grugett 2022-04-11 17:06:51 -05:00
parent e53cde5b34
commit ff1cb68077

View File

@ -3,10 +3,11 @@ import { LinkIcon } from '@heroicons/react/outline'
import { Menu, Transition } from '@headlessui/react' import { Menu, Transition } from '@headlessui/react'
import { Contract } from '../../common/contract' import { Contract } from '../../common/contract'
import { copyToClipboard } from '../lib/util/copy' import { copyToClipboard } from '../lib/util/copy'
import { contractPath } from '../lib/firebase/contracts'
import { ENV_CONFIG } from '../../common/envs/constants'
function copyCurrentUrl(contract: Contract) { function copyContractUrl(contract: Contract) {
const url = window.location.href copyToClipboard(`https://${ENV_CONFIG.domain}${contractPath(contract)}`)
copyToClipboard(url)
} }
export function CopyLinkButton(props: { contract: Contract }) { export function CopyLinkButton(props: { contract: Contract }) {
@ -16,7 +17,7 @@ export function CopyLinkButton(props: { contract: Contract }) {
<Menu <Menu
as="div" as="div"
className="relative z-10 flex-shrink-0" className="relative z-10 flex-shrink-0"
onMouseUp={() => copyCurrentUrl(contract)} onMouseUp={() => copyContractUrl(contract)}
> >
<Menu.Button <Menu.Button
className="btn btn-xs normal-case" className="btn btn-xs normal-case"