Skip to content
Snippets Groups Projects

Tweet comments

Merged David requested to merge tweetComments into main
6 files
+ 11
23
Compare changes
  • Side-by-side
  • Inline
Files
6
@@ -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" >
Loading