diff --git a/app/frontend/src/Components/Comment/Comment/Comment.module.scss b/app/frontend/src/Components/Comment/Comment/Comment.module.scss index b25e6289..5148ea2b 100644 --- a/app/frontend/src/Components/Comment/Comment/Comment.module.scss +++ b/app/frontend/src/Components/Comment/Comment/Comment.module.scss @@ -5,7 +5,6 @@ background-color: $celadon; border-radius: 0.5em; position: relative; - max-width: 70em; word-break: break-word; gap: 0.5em; diff --git a/app/frontend/src/Components/Comment/Comment/Comment.tsx b/app/frontend/src/Components/Comment/Comment/Comment.tsx index c8414723..8effa75c 100644 --- a/app/frontend/src/Components/Comment/Comment/Comment.tsx +++ b/app/frontend/src/Components/Comment/Comment/Comment.tsx @@ -23,6 +23,8 @@ import Reply from "../Reply/Reply"; import { useNavigate } from "react-router-dom"; import CommentEditForm from "../CommentForm/CommentEditForm"; import { twj } from "tw-to-css"; +import { NotificationUtil } from "../../../Library/utils/notification"; +import clsx from "clsx"; function Comment({ comment, postId }: { comment: any; postId: string }) { const { upvote, downvote } = useVote({ @@ -32,13 +34,13 @@ function Comment({ comment, postId }: { comment: any; postId: string }) { }); const { user, isLoggedIn } = useAuth(); - const navigate = useNavigate(); const queryClient = useQueryClient(); const { mutate: removeComment } = useMutation( (id: string) => deleteComment(id), { onSuccess() { queryClient.invalidateQueries(["comments", postId]); + NotificationUtil.success("You successfully delete the comment."); }, onMutate(id: string) { queryClient.setQueriesData(["comments", postId], (prev: any) => { @@ -69,7 +71,7 @@ function Comment({ comment, postId }: { comment: any; postId: string }) { icon={} onClick={upvote} disabled={!isLoggedIn} - //className={clsx(post?.userVote === "UPVOTE" && styles.active)} + className={clsx(comment?.userVote === "UPVOTE" && styles.active)} />
{comment.overallVote}
@@ -80,7 +82,7 @@ function Comment({ comment, postId }: { comment: any; postId: string }) { icon={} onClick={downvote} disabled={!isLoggedIn} - //className={clsx(post?.userVote === "DOWNVOTE" && styles.active)} + className={clsx(comment?.userVote === "DOWNVOTE" && styles.active)} /> diff --git a/app/frontend/src/Components/Comment/Reply/Reply.module.scss b/app/frontend/src/Components/Comment/Reply/Reply.module.scss index 6ee22b5e..d9c89318 100644 --- a/app/frontend/src/Components/Comment/Reply/Reply.module.scss +++ b/app/frontend/src/Components/Comment/Reply/Reply.module.scss @@ -7,10 +7,11 @@ border-radius: 0.5em; display: grid; gap: 0.5em; + margin-bottom: 5px; grid-template-areas: "v t" "v m"; - grid-template-rows: 50px 25px; + grid-template-columns: 25px 1fr; .vote { justify-items: center; diff --git a/app/frontend/src/Components/Comment/Reply/Reply.tsx b/app/frontend/src/Components/Comment/Reply/Reply.tsx index e2f4f1ce..ca3e7650 100644 --- a/app/frontend/src/Components/Comment/Reply/Reply.tsx +++ b/app/frontend/src/Components/Comment/Reply/Reply.tsx @@ -7,6 +7,8 @@ import { useAuth } from "../../Hooks/useAuth"; import { useMutation } from "react-query"; import { deleteComment } from "../../../Services/comment"; import { useQueryClient } from "react-query"; +import { NotificationUtil } from "../../../Library/utils/notification"; +import clsx from "clsx"; function Reply({ reply }: { reply: any }) { const { upvote, downvote } = useVote({ @@ -23,6 +25,7 @@ function Reply({ reply }: { reply: any }) { { onSuccess() { queryClient.invalidateQueries(["comments", reply.post]); + NotificationUtil.success("You successfully delete the comment."); }, onMutate(id: string) { queryClient.setQueriesData(["comments", reply.post], (prev: any) => { @@ -40,9 +43,9 @@ function Reply({ reply }: { reply: any }) { shape="circle" size="small" icon={} - onClick={downvote} + onClick={upvote} disabled={!isLoggedIn} - //className={clsx(post?.userVote === "DOWNVOTE" && styles.active)} + className={clsx(reply?.userVote === "UPVOTE" && styles.active)} />
{reply.overallVote}