diff --git a/apps/nextjs/package.json b/apps/nextjs/package.json index 39886fb..f5e2f38 100644 --- a/apps/nextjs/package.json +++ b/apps/nextjs/package.json @@ -29,6 +29,7 @@ "next": "^14.1.0", "react": "18.2.0", "react-dom": "18.2.0", + "react-hook-form": "^7.52.1", "srt-parser-2": "^1.2.3", "superjson": "2.2.1", "zod": "^3.22.4" diff --git a/apps/nextjs/src/app/_components/navbar.tsx b/apps/nextjs/src/app/_components/navbar.tsx new file mode 100644 index 0000000..3962c29 --- /dev/null +++ b/apps/nextjs/src/app/_components/navbar.tsx @@ -0,0 +1,15 @@ +import { Card } from "@quotes/ui/card"; +import { SearchBar } from "./search-bar"; +import { db } from "@quotes/db"; + +export async function Navbar(): Promise { + const showData = await db.query.show.findMany() + + return ( + +
Quotes
+ +
+ + ) +} diff --git a/apps/nextjs/src/app/_components/posts.tsx b/apps/nextjs/src/app/_components/posts.tsx deleted file mode 100644 index f80b618..0000000 --- a/apps/nextjs/src/app/_components/posts.tsx +++ /dev/null @@ -1,180 +0,0 @@ -"use client"; - -import { use } from "react"; -import { Button } from "@quotes/ui/button"; -import { Card, CardContent, CardHeader, CardTitle } from "@quotes/ui/card"; -import { - Form, - FormControl, - FormField, - FormItem, - FormMessage, - useForm, -} from "@quotes/ui/form"; -import { Input } from "@quotes/ui/input"; -import { Skeleton } from "@quotes/ui/skeleton"; -import { Textarea } from "@quotes/ui/textarea"; -import { toast } from "@quotes/ui/toast"; -import { CreatePostSchema } from "@quotes/validators"; -import { IconTrash } from "@tabler/icons-react"; - -import { api } from "~/trpc/react"; - -export function CreatePostForm(): React.ReactElement { - const form = useForm({ - schema: CreatePostSchema, - defaultValues: { - content: "", - title: "", - }, - }); - - const utils = api.useUtils(); - const createPost = api.post.create.useMutation({ - onSuccess: async () => { - form.reset(); - await utils.post.invalidate(); - }, - onError: (err) => { - toast.error( - err.data?.code === "UNAUTHORIZED" - ? "You must be logged in to post" - : "Failed to create post", - ); - }, - }); - - function submit(data: { title: string; content: string }): void { - toast.promise(createPost.mutateAsync(data), { - loading: "Creating post...", - success: "Post created!", - error: "Failed to create post!", - }); - } - - return ( -
- { - submit(data); - })} - > - ( - - - - - - - )} - /> - ( - - -