Skip to content

Scheduling infrastructure for absolutely everyone.

Add: copy link option (#5236)

Harsh Singhcddcd742f651
diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json
index 5a2ae2448bd..f1fa89331d7 100644
--- a/apps/web/public/static/locales/en/common.json
+++ b/apps/web/public/static/locales/en/common.json
@@ -140,6 +140,7 @@
"slide_zoom_drag_instructions": "Slide to zoom, drag to reposition",
"view_notifications": "View notifications",
"view_public_page": "View public page",
+ "copy_public_page_link":"Copy public page link",
"sign_out": "Sign out",
"add_another": "Add another",
"install_another": "Install another",
diff --git a/packages/ui/v2/core/Shell.tsx b/packages/ui/v2/core/Shell.tsx
index 6c25e8faf04..abbf53e120c 100644
--- a/packages/ui/v2/core/Shell.tsx
+++ b/packages/ui/v2/core/Shell.tsx
@@ -30,6 +30,7 @@ import Dropdown, {
import { Icon } from "@calcom/ui/Icon";
import TimezoneChangeDialog from "@calcom/ui/TimezoneChangeDialog";
import Button from "@calcom/ui/v2/core/Button";
+import showToast from "@calcom/ui/v2/core/notifications";
/* TODO: Get this from endpoint */
import pkg from "../../../../apps/web/package.json";
@@ -314,16 +315,33 @@ function UserDropdown({ small }: { small?: boolean }) {
</DropdownMenuItem>
<DropdownMenuSeparator className="h-px bg-gray-200" />
{user.username && (
- <DropdownMenuItem>
- <a
- target="_blank"
- rel="noopener noreferrer"
- href={`${process.env.NEXT_PUBLIC_WEBSITE_URL}/${user.username}`}
- className="flex items-center px-4 py-2 text-sm text-gray-700">
- <Icon.FiExternalLink className="h-4 w-4 text-gray-500 ltr:mr-2 rtl:ml-3" />{" "}
- {t("view_public_page")}
- </a>
- </DropdownMenuItem>
+ <>
+ <DropdownMenuItem>
+ <a
+ target="_blank"
+ rel="noopener noreferrer"
+ href={`${process.env.NEXT_PUBLIC_WEBSITE_URL}/${user.username}`}
+ className="flex items-center px-4 py-2 text-sm text-gray-700">
+ <Icon.FiExternalLink className="h-4 w-4 text-gray-500 ltr:mr-2 rtl:ml-3" />{" "}
+ {t("view_public_page")}
+ </a>
+ </DropdownMenuItem>
+ <DropdownMenuItem>
+ <a
+ href="#"
+ onClick={(e) => {
+ e.preventDefault();
+ navigator.clipboard.writeText(
+ `${process.env.NEXT_PUBLIC_WEBSITE_URL}/${user.username}`
+ );
+ showToast(t("link_copied"), "success");
+ }}
+ className="flex items-center px-4 py-2 text-sm text-gray-700">
+ <Icon.FiLink className="h-4 w-4 text-gray-500 ltr:mr-2 rtl:ml-3" />{" "}
+ {t("copy_public_page_link")}
+ </a>
+ </DropdownMenuItem>
+ </>
)}
<DropdownMenuSeparator className="h-px bg-gray-200" />
<DropdownMenuItem>