Skip to content
Snippets Groups Projects
Commit 57cd1fae authored by DESKTOP-9FO96TP\hehexd's avatar DESKTOP-9FO96TP\hehexd
Browse files

fixed build error

parent 5fd4276b
No related branches found
No related tags found
1 merge request!23Tweet comments
Pipeline #36771 failed
...@@ -4,11 +4,8 @@ import PostCommentForm from "@/components/post-comment"; ...@@ -4,11 +4,8 @@ import PostCommentForm from "@/components/post-comment";
import PostItem from "@/components/post-item"; import PostItem from "@/components/post-item";
import { db } from "@/lib/db"; import { db } from "@/lib/db";
import { Prisma } from "@prisma/client"; 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 messageType = any // Prisma.PostUncheckedCreateInput
type messageItemProps = { type messageItemProps = {
msg: messageType; msg: messageType;
...@@ -17,7 +14,7 @@ type messageItemProps = { ...@@ -17,7 +14,7 @@ type messageItemProps = {
export default async function PostDetail({ params }: { params: { postid: string } }) { export default async function PostDetail({ params }: { params: { postid: string } }) {
const postid = params.postid const postid = params.postid
let comments = null let comments = null
let message: messageType | null = null let message = null
try { try {
comments = await db.comment.findMany({ comments = await db.comment.findMany({
...@@ -68,14 +65,14 @@ export default async function PostDetail({ params }: { params: { postid: string ...@@ -68,14 +65,14 @@ export default async function PostDetail({ params }: { params: { postid: string
) )
} }
const CommentItem = ({ msg }: messageItemProps) => { const CommentItem = ({ msg }: any) => {
if (!msg.id) { if (!msg.id) {
return <div></div>; return <div></div>;
} }
return ( return (
<div className="flex border-b border-gray-200 py-4"> <div className="flex border-b border-gray-200 py-4">
<div className="flex-shrink-0"> <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>
<div className="ml-4 flex flex-col flex-grow"> <div className="ml-4 flex flex-col flex-grow">
<div> <div>
...@@ -89,7 +86,7 @@ const CommentItem = ({ msg }: messageItemProps) => { ...@@ -89,7 +86,7 @@ const CommentItem = ({ msg }: messageItemProps) => {
</div> </div>
<div className="mt-4 flex"> <div className="mt-4 flex">
<div className="bg-gray-200 rounded-lg py-10 px-20 mr-2"> <div className="bg-gray-200 rounded-lg py-10 px-20 mr-2">
{/* potential Image */}
</div> </div>
</div> </div>
<div className="flex justify-end" > <div className="flex justify-end" >
......
import CommentButton from "@/components/comment-button";
import LikeButton from "@/components/like-button";
import PostItem from "@/components/post-item"; import PostItem from "@/components/post-item";
import MessageItem from "@/components/post-item";
import PostMessageForm from "@/components/post-messages"; import PostMessageForm from "@/components/post-messages";
import { db } from "@/lib/db"; import { db } from "@/lib/db";
import { Prisma } from "@prisma/client"; import { Prisma } from "@prisma/client";
/* export const revalidate = 5; */ // revalidate this page every 60 seconds
type messageType = any // Prisma.PostUncheckedCreateInput type messageType = any // Prisma.PostUncheckedCreateInput
type messageItemProps = { type messageItemProps = {
...@@ -35,7 +31,7 @@ export default async function HomePage() { ...@@ -35,7 +31,7 @@ export default async function HomePage() {
<h1>Home WIP</h1> <h1>Home WIP</h1>
<p>This will be where all Posts show up.</p> <p>This will be where all Posts show up.</p>
<p>Needs a reload after posting!!</p> <p>Needs a reload after posting!!</p>
<PostMessageForm data={messages} /> <PostMessageForm />
{messages ? {messages ?
<> <>
{messages.map((msg) => ( {messages.map((msg) => (
......
...@@ -15,13 +15,12 @@ export async function POST(req: NextRequest) { ...@@ -15,13 +15,12 @@ export async function POST(req: NextRequest) {
} }
const userId = session.user.id const userId = session.user.id
const data: comment = await req.json() const data = await req.json()
console.log("router data: " + data.message, "status:") console.log("router data: " + data.message, "status:")
try { try {
await db.comment.create({ await db.comment.create({
/* data: data */
data: { data: {
message: data.message, message: data.message,
postId: data.postId, postId: data.postId,
......
...@@ -7,9 +7,6 @@ import { Icons } from "./icons"; ...@@ -7,9 +7,6 @@ import { Icons } from "./icons";
import { Button } from "./ui/button"; import { Button } from "./ui/button";
import Link from "next/link"; import Link from "next/link";
type commentType = Prisma.CommentUncheckedCreateInput
type postType = Prisma.PostSelect
export default function CommentButton(props: { data: any }) { export default function CommentButton(props: { data: any }) {
const postid = props.data.id const postid = props.data.id
......
...@@ -6,14 +6,14 @@ type messageItemProps = { ...@@ -6,14 +6,14 @@ type messageItemProps = {
msg: messageType; msg: messageType;
}; };
export default function PostItem({ msg }: messageItemProps) { export default function PostItem({ msg }: any) {
if (!msg.id) { if (!msg.id) {
return <div></div>; return <div></div>;
} }
return ( return (
<div className="flex border-b border-gray-200 py-4"> <div className="flex border-b border-gray-200 py-4">
<div className="flex-shrink-0"> <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>
<div className="ml-4 flex flex-col flex-grow"> <div className="ml-4 flex flex-col flex-grow">
<div> <div>
...@@ -27,7 +27,6 @@ export default function PostItem({ msg }: messageItemProps) { ...@@ -27,7 +27,6 @@ export default function PostItem({ msg }: messageItemProps) {
</div> </div>
<div className="mt-4 flex"> <div className="mt-4 flex">
<div className="bg-gray-200 rounded-lg py-10 px-20 mr-2"> <div className="bg-gray-200 rounded-lg py-10 px-20 mr-2">
{/* potential Image */}
</div> </div>
</div> </div>
<div className="flex justify-end" > <div className="flex justify-end" >
......
...@@ -6,7 +6,7 @@ import { startTransition, useEffect, useState } from "react"; ...@@ -6,7 +6,7 @@ import { startTransition, useEffect, useState } from "react";
type messageType = Prisma.PostUncheckedCreateInput 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 [formData, setFormData] = useState<messageType>({ content: "" } as messageType);
const router = useRouter(); const router = useRouter();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment