diff --git a/app/(main)/(routes)/servers/[serverId]/channels/[channelId]/page.tsx b/app/(main)/(routes)/servers/[serverId]/channels/[channelId]/page.tsx
index 0714e39..030e423 100644
--- a/app/(main)/(routes)/servers/[serverId]/channels/[channelId]/page.tsx
+++ b/app/(main)/(routes)/servers/[serverId]/channels/[channelId]/page.tsx
@@ -3,6 +3,7 @@ import { redirectToSignIn } from "@clerk/nextjs";
import { db } from "@/lib/db";
import { redirect } from "next/navigation";
import { ChatHeader } from "@/components/chat/chat-header";
+import { ChatInput } from "@/components/chat/chat-input";
interface ChannelIdPageProps {
params: {
@@ -41,6 +42,11 @@ const ChannelIdPage = async ({
return (
)
}
diff --git a/components/chat/chat-input.tsx b/components/chat/chat-input.tsx
new file mode 100644
index 0000000..775331f
--- /dev/null
+++ b/components/chat/chat-input.tsx
@@ -0,0 +1,91 @@
+"use client"
+
+import { useForm } from "react-hook-form";
+import * as z from "zod";
+import axios from "axios";
+import qs from "query-string";
+import { zodResolver } from "@hookform/resolvers/zod";
+
+import {
+ Form,
+ FormControl,
+ FormField,
+ FormItem,
+} from "@/components/ui/form";
+import { Input } from "@/components/ui/input";
+import { Plus, Smile } from "lucide-react";
+
+interface ChatInputProps {
+ apiUrl: string;
+ query: Record;
+ name: string;
+ type: "conversation" | "channel";
+}
+
+const formSchema = z.object({
+ content: z.string().min(1),
+});
+
+export const ChatInput = ({
+ apiUrl,
+ query,
+ name,
+ type
+}: ChatInputProps) => {
+ const form = useForm>({
+ resolver: zodResolver(formSchema),
+ defaultValues: {
+ content: "",
+ }
+ });
+
+ const isLoading = form.formState.isSubmitting;
+
+ const onSubmit = async (values: z.infer) => {
+ try{
+ const url = qs.stringifyUrl({
+ url: apiUrl,
+ query,
+ });
+
+ await axios.post(url, values);
+ }catch(error){
+ console.log(error);
+ }
+ }
+
+ return (
+
+
+ )
+}
\ No newline at end of file