From 23353dd65e21bc28a7e47698f88ac6d80c2a0a58 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sat, 28 Jan 2023 21:15:15 -0800 Subject: [PATCH] Don't allow copying on new party page --- components/Header/index.tsx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/components/Header/index.tsx b/components/Header/index.tsx index 66b527c2..5b391844 100644 --- a/components/Header/index.tsx +++ b/components/Header/index.tsx @@ -95,16 +95,20 @@ const Header = () => { } function copyToClipboard() { - const el = document.createElement('input') - el.value = window.location.href - el.id = 'url-input' - document.body.appendChild(el) + const path = router.asPath.split('/')[1] - el.select() - document.execCommand('copy') - el.remove() + if (path === 'p') { + const el = document.createElement('input') + el.value = window.location.href + el.id = 'url-input' + document.body.appendChild(el) - setCopyToastOpen(true) + el.select() + document.execCommand('copy') + el.remove() + + setCopyToastOpen(true) + } } function handleNewParty(event: React.MouseEvent, path: string) {