diff --git a/public/assets/icons/invite.svg b/public/assets/icons/invite.svg new file mode 100644 index 0000000..63b7138 --- /dev/null +++ b/public/assets/icons/invite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/shared/LeftSidebar.tsx b/src/components/shared/LeftSidebar.tsx index dc01f3b..b404460 100644 --- a/src/components/shared/LeftSidebar.tsx +++ b/src/components/shared/LeftSidebar.tsx @@ -15,6 +15,28 @@ const LeftSidebar = () => { if (isSuccess) navigate(0); }, [isSuccess]); + const handleInviteClick = () => { + const currentURL = "https://opengram.vercel.app/sign-in"; + navigator.clipboard.writeText(`Hey! I am inviting you to join this amazing Social Media Application: ${currentURL}`) + .then(() => { + const popup = document.createElement('div'); + popup.textContent = "Invitation copied to clipboard!"; + popup.classList.add( + "fixed", "top-1/2", "left-1/2", "transform", "-translate-x-1/2", "-translate-y-1/2", + "bg-white", "text-black", "px-4", "py-2", "rounded", "z-50" + ); + document.body.appendChild(popup); + + setTimeout(() => { + document.body.removeChild(popup); + }, 3000); + }) + .catch((error: Error) => { + console.error("Failed to copy URL: ", error); + alert("Failed to copy URL!"); + }); + }; + return ( @@ -45,9 +67,8 @@ const LeftSidebar = () => { return ( { {link.label} @@ -68,9 +88,19 @@ const LeftSidebar = () => { })} + + + + Invite Your Friend + + + signOut()} >
Invite Your Friend