|
3 | 3 | import { useState } from "react"; |
4 | 4 | import { useMutation, useQueryClient } from "@tanstack/react-query"; |
5 | 5 | import ApplicantCommentEditorOrViewer from "./EditorOrViewer.component"; |
| 6 | +import BlurredComment from "./BlurredComment.component"; |
6 | 7 | import { deleteComment } from "@/src/apis/comment"; |
7 | 8 | import { postCommentsLike } from "@/src/apis/comment"; |
8 | 9 | import Icon from "@/components/common/Icon"; |
@@ -34,18 +35,19 @@ const CommentDeleteButton = ({ |
34 | 35 | return <button onClick={() => onDelete()}>삭제</button>; |
35 | 36 | }; |
36 | 37 |
|
37 | | -interface ApplicantCommentReq { |
| 38 | +interface ApplicantCommentRes { |
38 | 39 | id: string; |
39 | 40 | content: string; |
40 | 41 | createdAt: string; |
41 | 42 | interviewerName: string; |
42 | 43 | isLike: boolean; |
43 | 44 | likeCount: number; |
44 | 45 | canEdit: boolean; |
| 46 | + isBlurred: boolean; |
45 | 47 | } |
46 | 48 |
|
47 | 49 | interface ApplicantCommentDetailProps { |
48 | | - comment: ApplicantCommentReq; |
| 50 | + comment: ApplicantCommentRes; |
49 | 51 | cardId: number; |
50 | 52 | generation: string; |
51 | 53 | } |
@@ -78,29 +80,39 @@ const ApplicantCommentDetail = ({ |
78 | 80 | {new Date(+comment.createdAt).toLocaleDateString()} |
79 | 81 | </div> |
80 | 82 | </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 | + > |
82 | 88 | <Icon icon={comment.isLike ? "faceSmilingFill" : "faceSmiling"} /> |
83 | 89 | <span className="text-xs text-secondary-200"> |
84 | 90 | {comment.likeCount} |
85 | 91 | </span> |
86 | 92 | </button> |
87 | 93 | </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} |
99 | 101 | commentId={comment.id} |
100 | | - cardId={cardId} |
101 | | - generation={generation} |
| 102 | + setIsEdit={setIsEdit} |
102 | 103 | /> |
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 | + </> |
104 | 116 | )} |
105 | 117 | </div> |
106 | 118 | ); |
|
0 commit comments