Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions apps/web/components/rooms/participants-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
SheetHeader,
SheetTitle,
} from "@call/ui/components/sheet";
import { usePathname } from "next/navigation";
import { useEffect, useRef, useState } from "react";
import {
FiCheck,
Expand Down Expand Up @@ -159,6 +160,20 @@ export function ParticipantsSidebar({
}
};

// Generate shareable invite URL for the current call
const invitePath = usePathname();
const inviteURL = `${window.location.origin}${invitePath}`;

const copyInviteURL = async () => {
try {
await navigator.clipboard.writeText(inviteURL);
toast.success("Invite link copied");
} catch (error) {
console.error("Error copying invite URL:", error);
toast.error("Failed to copy invite link");
}
};

return (
<Sheet open={open} onOpenChange={onOpenChange}>
<SheetContent side="right" className="w-80 p-4">
Expand Down Expand Up @@ -342,6 +357,11 @@ export function ParticipantsSidebar({
</>
)}
</div>
<div className="absolute bottom-4 left-4 right-4">
<Button onClick={copyInviteURL} variant="outline" className="w-full">
Invite
</Button>
</div>
</SheetContent>
</Sheet>
);
Expand Down