@@ -1,104 +0,0 @@
1-"use client";
2-
3-import Link from "next/link";
4-import { useRouter } from "next/navigation";
5-import { useCallback, useState } from "react";
6-import { useLocalStorage } from "usehooks-ts";
7-
8-import { pacifico } from "@/components/pacifico-font";
9-import PrimaryButton from "@/components/primary-button";
10-import slugify from "@/lib/slugify";
11-
12-export default function NewStreamPage() {
13- const [appId, setAppId] = useLocalStorage("app-id", "");
14- const [token, setToken] = useLocalStorage("token", "");
15- const [channel, setChannel] = useLocalStorage("channel", "");
16- const [error, setError] = useState("");
17- const router = useRouter();
18-
19- const handleChange = useCallback(
20- (e: React.ChangeEvent<HTMLInputElement>) => {
21- const name: string = e.target.name;
22-
23- if (name === "app-id") setAppId(e.target.value);
24- if (name === "token") setToken(e.target.value);
25- if (name === "channel") setChannel(e.target.value);
26-
27- // Clear the error if it exists after a new change
28- if (error) setError("");
29- },
30- [error, setAppId, setToken, setChannel],
31- );
32-
33- const handleNextClick = useCallback(() => {
34- if (!appId || !token || !channel) setError("All fields are required.");
35- else {
36- const slug = slugify(channel);
37- router.push("/" + slug + "/host");
38- }
39- }, [appId, token, channel, router]);
40-
41- return (
42- <div className="flex flex-col items-center gap-8">
43- <h3
44- className={`text-2xl font-bold p-16 text-rose-300 ${pacifico.className}`}
45- >
46- Please fill in the details bellow,
47- </h3>
48- <p>
49- All this information can be acquired from the{" "}
50- <Link
51- className="text-rose-600 active:text-rose-300 visited:text-rose-800"
52- target="_blank"
53- href="https://console.agora.io/v2/project-management"
54- >
55- AgoraIO Console
56- </Link>
57- </p>
58- <div className="w-1/2 flex flex-col gap-4">
59- <label>Tell us your App ID from AgoraIO</label>
60- <input
61- className="text-stone-200 bg-stone-800 rounded-xl p-4 w-full placeholder:text-stone-700"
62- name="app-id"
63- type="text"
64- value={appId}
65- onChange={handleChange}
66- placeholder="Your app id here..."
67- />
68- </div>
69-
70- <div className="w-1/2 flex flex-col gap-4">
71- <label>Tell us your AgoraIO token</label>
72- <input
73- className="text-stone-200 bg-stone-800 rounded-xl p-4 w-full placeholder:text-stone-700"
74- name="token"
75- type="text"
76- value={token}
77- onChange={handleChange}
78- placeholder="Your token here..."
79- />
80- </div>
81-
82- <div className="w-1/2 flex flex-col gap-4">
83- <label>Tell us your AgoraIO channel name</label>
84- <input
85- className="text-stone-200 bg-stone-800 rounded-xl p-4 w-full placeholder:text-stone-700"
86- name="channel"
87- type="text"
88- value={channel}
89- onChange={handleChange}
90- placeholder="Your token here..."
91- />
92- </div>
93-
94- <div className="w-1/2 flex flex-col gap-4">
95- <button onClick={handleNextClick}>
96- <PrimaryButton>
97- <p className="px-4 py-2">Next</p>
98- </PrimaryButton>
99- </button>
100- {error && <p className="text-rose-600">{error}</p>}
101- </div>
102- </div>
103- );
104-}