diff --git a/app/(content)/(home)/home/[postid]/page.tsx b/app/(content)/(home)/home/[postid]/page.tsx index 5345184a84c2ce0231a475f495387c194f3a424e..95fe4db38ca57eea5e47b573d429a738af47f8c5 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 862917b8051e5fdf04960b37e64601f099595701..e749ae1fe69c13868c6b29a2c7921a0f60038434 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 93429aa22ec0c70d226cd7adc84e50332e41548b..86001bf164177dd5cc2a60d1d072445afa0c5656 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 a1c71baed140c9f6ac46e4c453ea24babb56f00f..f124f7200189e5195e118fc2395f87428ee475c6 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 f2cbce716bb1d2b09e3edf7d49c268b4d713410b..c348a94568387e8bb1927e4f6ea92d101e2ee4c1 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 a870e16e391d2d34bd17b962d7f1c189486fd24a..85ee1cfc6da452448e85a9cad33c073ab86f5d99 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();