Add: copy link option (#5236)

* add: new item and local var

* add: copy link func

Co-authored-by: root <root@pop-os.localdomain>
Co-authored-by: alannnc <alannnc@gmail.com>
pull/5218/head^2
Harsh Singh 2022-10-27 02:42:25 +05:30 committed by GitHub
parent a7a82a6b51
commit cddcd742f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 10 deletions

View File

@ -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",

View File

@ -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>