diff --git a/src/components/Posts.jsx b/src/components/Posts.jsx index f9b9682..798f8cf 100644 --- a/src/components/Posts.jsx +++ b/src/components/Posts.jsx @@ -7,6 +7,7 @@ import { getDocs, doc, updateDoc, + deleteDoc, query, where, orderBy, @@ -16,6 +17,7 @@ import { useAuthState } from "react-firebase-hooks/auth"; import { CgProfile } from "react-icons/cg"; import Modal from "./Modal"; import { BiSolidUpvote, BiSolidDownvote } from "react-icons/bi"; +import { MdDelete } from "react-icons/md"; import { FaReply } from "react-icons/fa"; import { categoryData } from "../data"; @@ -349,23 +351,35 @@ const Posts = (props) => { key={post.id} className="border-blue-100 border p-4 m-2 flex flex-col gap-2 rounded-md drop-shadow-md bg-white hover:shadow-xl transition duration-300 ease-in-out" > -
- -
-
- {post.author ?? "Anonymous"} -
- {new Date(post?.timestamp)?.toDateString()} -
-
- {/* {console.log(post.category)} */} - {post?.category - ? post.category.map((val, key) => { - return {val}   ; - }) - : "uncategorized"} +
+
+ +
+
+ {post.author ?? "Anonymous"} +
+ {new Date(post?.timestamp)?.toDateString()} +
+
+ {/* {console.log(post.category)} */} + {post?.category + ? post.category.map((val, key) => { + return {val}   ; + }) + : "uncategorized"} +
+
diff --git a/src/pages/Post.jsx b/src/pages/Post.jsx index fc267c0..734273f 100644 --- a/src/pages/Post.jsx +++ b/src/pages/Post.jsx @@ -87,17 +87,6 @@ const Post = () => { "metadata.upvotes": upvoteList, }); } - - // const updatedPost = { - // ...postDetail, - // upvotes: upvoteList, - // }; - - // setPostDetail(updatedPost); - - // await updateDoc(docRef, { - // "metadata.upvotes": upvoteList, - // }); } }; @@ -164,19 +153,6 @@ const Post = () => { "metadata.downvotes": downvoteList, }); } - - // downvoteList.push(user.uid); - - // const updatedPost = { - // ...postDetail, - // downvotes: downvoteList, - // }; - - // setPostDetail(updatedPost); - - // await updateDoc(docRef, { - // "metadata.downvotes": downvoteList, - // }); } };