From c9e4ab8b992fa0df355de35ce3bd7693f00acd8d Mon Sep 17 00:00:00 2001
From: ilkin-overleaf <100852799+ilkin-overleaf@users.noreply.github.com>
Date: Wed, 10 Jun 2026 11:04:49 +0300
Subject: [PATCH] Merge pull request #33166 from
overleaf/ii-share-modal-copy-link
[web] Share modal copy sharing link button
GitOrigin-RevId: a95f879196528ec3bc998558a6838c52aac33069
---
.../web/frontend/extracted-translations.json | 2 +
.../components/copy-sharing-link-button.tsx | 48 +++++++++++++
.../components/project-access.tsx | 2 +-
.../share-project-modal-content.tsx | 9 ++-
services/web/locales/en.json | 2 +
.../components/share-project-modal.test.tsx | 70 +++++++++++++++++++
6 files changed, 131 insertions(+), 2 deletions(-)
create mode 100644 services/web/frontend/js/features/share-project-modal/components/copy-sharing-link-button.tsx
diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json
index 3cb4acae63..9830089d88 100644
--- a/services/web/frontend/extracted-translations.json
+++ b/services/web/frontend/extracted-translations.json
@@ -387,6 +387,7 @@
"copy": "",
"copy_project": "",
"copy_response": "",
+ "copy_sharing_link": "",
"copying": "",
"cost_summary": "",
"could_not_save_reference_to_bib_file": "",
@@ -1126,6 +1127,7 @@
"link_account": "",
"link_accounts": "",
"link_accounts_and_add_email": "",
+ "link_copied": "",
"link_institutional_email_get_started": "",
"link_sharing": "",
"link_sharing_is_off_short": "",
diff --git a/services/web/frontend/js/features/share-project-modal/components/copy-sharing-link-button.tsx b/services/web/frontend/js/features/share-project-modal/components/copy-sharing-link-button.tsx
new file mode 100644
index 0000000000..ef5e06df10
--- /dev/null
+++ b/services/web/frontend/js/features/share-project-modal/components/copy-sharing-link-button.tsx
@@ -0,0 +1,48 @@
+import { useTranslation } from 'react-i18next'
+import OLButton from '@/shared/components/ol/ol-button'
+import { useShareProjectContext } from '@/features/share-project-modal/components/share-project-modal'
+import { useProjectContext } from '@/shared/context/project-context'
+import { useUserContext } from '@/shared/context/user-context'
+import { debugConsole } from '@/utils/debugging'
+import getMeta from '@/utils/meta'
+
+export default function CopySharingLinkButton() {
+ const { t } = useTranslation()
+ const { sharingLinkData, projectAccess, setSuccessActionMessage } =
+ useShareProjectContext()
+ const { projectId } = useProjectContext()
+ const { isAdmin } = useUserContext()
+
+ const isCopyBtnEnabled =
+ Boolean(navigator.clipboard?.writeText) &&
+ Boolean(sharingLinkData?.token) &&
+ (projectAccess === 'anyoneInXyzWithTheLink' ||
+ projectAccess === 'anyoneWithTheLink')
+
+ const handleCopyClick = () => {
+ if (!sharingLinkData?.token) {
+ return
+ }
+
+ const origin = isAdmin
+ ? getMeta('ol-ExposedSettings').siteUrl
+ : window.location.origin
+ const link = `${origin}/project/${projectId}/share#${sharingLinkData.token}`
+
+ navigator.clipboard
+ .writeText(link)
+ .then(() => setSuccessActionMessage(t('link_copied')))
+ .catch(debugConsole.error)
+ }
+
+ return (
+