Skip to content

Commit 7910713

Browse files
authored
feat: 312-comment-blur(#312)
feat: 코멘트 블러처리 기능 추가
2 parents e9227bc + 006d4a9 commit 7910713

File tree

3 files changed

+39
-17
lines changed

3 files changed

+39
-17
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const BlurredComment = () => {
2+
return (
3+
<div className="select-none blur-sm text-sm">
4+
자신의 댓글만 조회할 수 있습니다.
5+
</div>
6+
);
7+
};
8+
9+
export default BlurredComment;

frontend/components/applicant/applicantNode/comment/CommentDetail.component.tsx

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { useState } from "react";
44
import { useMutation, useQueryClient } from "@tanstack/react-query";
55
import ApplicantCommentEditorOrViewer from "./EditorOrViewer.component";
6+
import BlurredComment from "./BlurredComment.component";
67
import { deleteComment } from "@/src/apis/comment";
78
import { postCommentsLike } from "@/src/apis/comment";
89
import Icon from "@/components/common/Icon";
@@ -34,18 +35,19 @@ const CommentDeleteButton = ({
3435
return <button onClick={() => onDelete()}>삭제</button>;
3536
};
3637

37-
interface ApplicantCommentReq {
38+
interface ApplicantCommentRes {
3839
id: string;
3940
content: string;
4041
createdAt: string;
4142
interviewerName: string;
4243
isLike: boolean;
4344
likeCount: number;
4445
canEdit: boolean;
46+
isBlurred: boolean;
4547
}
4648

4749
interface ApplicantCommentDetailProps {
48-
comment: ApplicantCommentReq;
50+
comment: ApplicantCommentRes;
4951
cardId: number;
5052
generation: string;
5153
}
@@ -78,29 +80,39 @@ const ApplicantCommentDetail = ({
7880
{new Date(+comment.createdAt).toLocaleDateString()}
7981
</div>
8082
</div>
81-
<button onClick={() => heartToggle()} className="flex gap-2 items-end">
83+
<button
84+
onClick={() => heartToggle()}
85+
className="flex gap-2 items-end"
86+
disabled={comment.isBlurred}
87+
>
8288
<Icon icon={comment.isLike ? "faceSmilingFill" : "faceSmiling"} />
8389
<span className="text-xs text-secondary-200">
8490
{comment.likeCount}
8591
</span>
8692
</button>
8793
</div>
88-
<ApplicantCommentEditorOrViewer
89-
isEdit={isEdit}
90-
content={comment.content}
91-
commentId={comment.id}
92-
setIsEdit={setIsEdit}
93-
/>
94-
{comment.canEdit && (
95-
<div className="flex text-sm gap-2 text-secondary-200 items-center">
96-
<button onClick={() => setIsEdit((prev) => !prev)}>수정</button>
97-
<div className="border-x-[0.5px] h-4 !w-0 border-secondary-200"></div>
98-
<CommentDeleteButton
94+
{comment.isBlurred ? (
95+
<BlurredComment />
96+
) : (
97+
<>
98+
<ApplicantCommentEditorOrViewer
99+
isEdit={isEdit}
100+
content={comment.content}
99101
commentId={comment.id}
100-
cardId={cardId}
101-
generation={generation}
102+
setIsEdit={setIsEdit}
102103
/>
103-
</div>
104+
{comment.canEdit && (
105+
<div className="flex text-sm gap-2 text-secondary-200 items-center">
106+
<button onClick={() => setIsEdit((prev) => !prev)}>수정</button>
107+
<div className="border-x-[0.5px] h-4 !w-0 border-secondary-200"></div>
108+
<CommentDeleteButton
109+
commentId={comment.id}
110+
cardId={cardId}
111+
generation={generation}
112+
/>
113+
</div>
114+
)}
115+
</>
104116
)}
105117
</div>
106118
);

frontend/src/apis/comment/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export interface CommentRes {
88
isLike: boolean;
99
likeCount: number;
1010
canEdit: boolean;
11+
isBlurred: boolean;
1112
}
1213

1314
export interface CommentReq {

0 commit comments

Comments
 (0)