From 57cd1fae40ae50a926531c3613d47f96693f527f Mon Sep 17 00:00:00 2001 From: "DESKTOP-9FO96TP\\hehexd" <davidjakszta@outlook.de> Date: Tue, 6 Jun 2023 16:46:24 +0200 Subject: [PATCH] fixed build error --- app/(content)/(home)/home/[postid]/page.tsx | 13 +++++-------- app/(content)/(home)/home/page.tsx | 8 ++------ app/api/comments/route.ts | 3 +-- components/comment-button.tsx | 3 --- components/post-item.tsx | 5 ++--- components/post-messages.tsx | 2 +- 6 files changed, 11 insertions(+), 23 deletions(-) diff --git a/app/(content)/(home)/home/[postid]/page.tsx b/app/(content)/(home)/home/[postid]/page.tsx index 5345184..95fe4db 100644 --- a/app/(content)/(home)/home/[postid]/page.tsx +++ b/app/(content)/(home)/home/[postid]/page.tsx @@ -4,11 +4,8 @@ import PostCommentForm from "@/components/post-comment"; import PostItem from "@/components/post-item"; import { db } from "@/lib/db"; import { Prisma } from "@prisma/client"; -/* export const revalidate = 5; */ // revalidate this page every 5 seconds +export const revalidate = 5; // revalidate this page every 5 seconds - - -type commentType = Prisma.CommentUncheckedCreateInput type messageType = any // Prisma.PostUncheckedCreateInput type messageItemProps = { msg: messageType; @@ -17,7 +14,7 @@ type messageItemProps = { export default async function PostDetail({ params }: { params: { postid: string } }) { const postid = params.postid let comments = null - let message: messageType | null = null + let message = null try { comments = await db.comment.findMany({ @@ -68,14 +65,14 @@ export default async function PostDetail({ params }: { params: { postid: string ) } -const CommentItem = ({ msg }: messageItemProps) => { +const CommentItem = ({ msg }: any) => { if (!msg.id) { return <div></div>; } return ( <div className="flex border-b border-gray-200 py-4"> <div className="flex-shrink-0"> - <div className="h-10 w-10 rounded-full bg-gray-300"></div> {/* Profile picture */} + <div className="h-10 w-10 rounded-full bg-gray-300"></div> </div> <div className="ml-4 flex flex-col flex-grow"> <div> @@ -89,7 +86,7 @@ const CommentItem = ({ msg }: messageItemProps) => { </div> <div className="mt-4 flex"> <div className="bg-gray-200 rounded-lg py-10 px-20 mr-2"> - {/* potential Image */} + </div> </div> <div className="flex justify-end" > diff --git a/app/(content)/(home)/home/page.tsx b/app/(content)/(home)/home/page.tsx index 862917b..e749ae1 100644 --- a/app/(content)/(home)/home/page.tsx +++ b/app/(content)/(home)/home/page.tsx @@ -1,12 +1,8 @@ - -import CommentButton from "@/components/comment-button"; -import LikeButton from "@/components/like-button"; import PostItem from "@/components/post-item"; -import MessageItem from "@/components/post-item"; import PostMessageForm from "@/components/post-messages"; import { db } from "@/lib/db"; import { Prisma } from "@prisma/client"; -/* export const revalidate = 5; */ // revalidate this page every 60 seconds + type messageType = any // Prisma.PostUncheckedCreateInput type messageItemProps = { @@ -35,7 +31,7 @@ export default async function HomePage() { <h1>Home WIP</h1> <p>This will be where all Posts show up.</p> <p>Needs a reload after posting!!</p> - <PostMessageForm data={messages} /> + <PostMessageForm /> {messages ? <> {messages.map((msg) => ( diff --git a/app/api/comments/route.ts b/app/api/comments/route.ts index 93429aa..86001bf 100644 --- a/app/api/comments/route.ts +++ b/app/api/comments/route.ts @@ -15,13 +15,12 @@ export async function POST(req: NextRequest) { } const userId = session.user.id - const data: comment = await req.json() + const data = await req.json() console.log("router data: " + data.message, "status:") try { await db.comment.create({ - /* data: data */ data: { message: data.message, postId: data.postId, diff --git a/components/comment-button.tsx b/components/comment-button.tsx index a1c71ba..f124f72 100644 --- a/components/comment-button.tsx +++ b/components/comment-button.tsx @@ -7,9 +7,6 @@ import { Icons } from "./icons"; import { Button } from "./ui/button"; import Link from "next/link"; -type commentType = Prisma.CommentUncheckedCreateInput -type postType = Prisma.PostSelect - export default function CommentButton(props: { data: any }) { const postid = props.data.id diff --git a/components/post-item.tsx b/components/post-item.tsx index f2cbce7..c348a94 100644 --- a/components/post-item.tsx +++ b/components/post-item.tsx @@ -6,14 +6,14 @@ type messageItemProps = { msg: messageType; }; -export default function PostItem({ msg }: messageItemProps) { +export default function PostItem({ msg }: any) { if (!msg.id) { return <div></div>; } return ( <div className="flex border-b border-gray-200 py-4"> <div className="flex-shrink-0"> - <div className="h-10 w-10 rounded-full bg-gray-300"></div> {/* Profile picture */} + <div className="h-10 w-10 rounded-full bg-gray-300"></div> </div> <div className="ml-4 flex flex-col flex-grow"> <div> @@ -27,7 +27,6 @@ export default function PostItem({ msg }: messageItemProps) { </div> <div className="mt-4 flex"> <div className="bg-gray-200 rounded-lg py-10 px-20 mr-2"> - {/* potential Image */} </div> </div> <div className="flex justify-end" > diff --git a/components/post-messages.tsx b/components/post-messages.tsx index a870e16..85ee1cf 100644 --- a/components/post-messages.tsx +++ b/components/post-messages.tsx @@ -6,7 +6,7 @@ import { startTransition, useEffect, useState } from "react"; type messageType = Prisma.PostUncheckedCreateInput -export default function PostMessageForm(props: { data: Post[] | null }) { +export default function PostMessageForm() { const [formData, setFormData] = useState<messageType>({ content: "" } as messageType); const router = useRouter(); -- GitLab