| layout | tailwind |
|---|---|
| menu | nav/home.html |
| permalink | /allPosts |
${description}
Show Comments
`; const closeButton = postElement.querySelector(".closeBtn"); closeButton.addEventListener("click", () => removePost(postId, postElement)); postElement.querySelector(`#show-comments-btn-${postId}`).addEventListener("click", () => { loadComments(postId, postElement) }); return postElement; } const loadComments = async (postId, postElement, loadShowingComments) => { const commentsSection = document.getElementById(`comments-section-${postId}`); if (!loadShowingComments) { commentsSection.classList.toggle("hidden"); } if (!commentsSection.classList.contains("hidden")) { postElement.querySelector(`#show-comments-btn-${postId}`).innerHTML = "Hide Comments" const comments = await getCommentsByPostId(postId) console.log(comments) commentsSection.innerHTML = ""; comments.map(comment => { const profilePicture = pythonURI + "/uploads/" + comment.user.uid + "/" + comment.user.pfp const commentElement = document.createElement("div") commentElement.className = "flex items-center space-x-4" commentElement.innerHTML = `
${comment.user.name}
${comment.content}