@@ -1,7 +1,10 @@
11 "use client";
22
33 import dynamic from "next/dynamic";
4-import { useLocalStorage } from "usehooks-ts";
4+import { useCallback, useEffect, useState } from "react";
5+import { FaRegCopy as CopyIcon } from "react-icons/fa";
6+import { IoMdCheckmark as CheckmarkIcon } from "react-icons/io";
7+import { useCopyToClipboard, useLocalStorage } from "usehooks-ts";
58
69 const AgoraProvider = dynamic(() => import("@/components/agora-provider"), {
710 ssr: false,
@@ -19,10 +22,36 @@ export default function StreamSetupPage({
1922 const [appId] = useLocalStorage("app-id", "");
2023 const [token] = useLocalStorage("token", "");
2124 const [channel] = useLocalStorage("channel", "");
25+ const [currentUrl, setCurrentUrl] = useState("");
26+ const [copied, copy] = useCopyToClipboard();
27+
28+ useEffect(() => {
29+ if (typeof window !== "undefined") {
30+ setCurrentUrl(window.location.href);
31+ }
32+ }, []);
2233
2334 return (
2435 <AgoraProvider>
2536 <div className="flex flex-col items-center gap-16">
37+ <div className="w-1/2 text-center">
38+ <p className="text-lg p-2">
39+ Share this url with your co-host for them to join you!
40+ </p>
41+
42+ <button
43+ className="flex flex-row justify-between bg-stone-600 p-4 rounded-xl w-full"
44+ onClick={() => copy(currentUrl)}
45+ >
46+ <pre className="">{currentUrl}</pre>
47+ {copied === currentUrl ? (
48+ <CheckmarkIcon size="1.25em" />
49+ ) : (
50+ <CopyIcon size="1.25em" />
51+ )}
52+ </button>
53+ </div>
54+
2655 <AgoraHost config={{ appId, channel, token }} />
2756 </div>
2857 </AgoraProvider>