From ff1cb68077d061c7a2f7250e1110c9b35443089a Mon Sep 17 00:00:00 2001 From: James Grugett Date: Mon, 11 Apr 2022 17:06:51 -0500 Subject: [PATCH] Copy contract url doesn't use current url --- web/components/copy-link-button.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/web/components/copy-link-button.tsx b/web/components/copy-link-button.tsx index b9480971..1e944311 100644 --- a/web/components/copy-link-button.tsx +++ b/web/components/copy-link-button.tsx @@ -3,10 +3,11 @@ import { LinkIcon } from '@heroicons/react/outline' import { Menu, Transition } from '@headlessui/react' import { Contract } from '../../common/contract' import { copyToClipboard } from '../lib/util/copy' +import { contractPath } from '../lib/firebase/contracts' +import { ENV_CONFIG } from '../../common/envs/constants' -function copyCurrentUrl(contract: Contract) { - const url = window.location.href - copyToClipboard(url) +function copyContractUrl(contract: Contract) { + copyToClipboard(`https://${ENV_CONFIG.domain}${contractPath(contract)}`) } export function CopyLinkButton(props: { contract: Contract }) { @@ -16,7 +17,7 @@ export function CopyLinkButton(props: { contract: Contract }) { copyCurrentUrl(contract)} + onMouseUp={() => copyContractUrl(contract)} >