From 1553801bc99fc8d5325d51b14d19810c09e9ca42 Mon Sep 17 00:00:00 2001 From: JISOO Date: Wed, 17 Apr 2024 22:30:00 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Fix:=20=EB=A6=AC=EB=B7=B0=EB=AA=A8=EB=8B=AC?= =?UTF-8?q?=20=EC=A4=91=EB=B3=B5=ED=83=9C=EA=B7=B8=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/modals/ReviewModal/index.tsx | 38 ++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/co-kkiri/src/components/modals/ReviewModal/index.tsx b/co-kkiri/src/components/modals/ReviewModal/index.tsx index c65ddb9a..006748f2 100644 --- a/co-kkiri/src/components/modals/ReviewModal/index.tsx +++ b/co-kkiri/src/components/modals/ReviewModal/index.tsx @@ -6,7 +6,8 @@ import { useRef } from "react"; import { Link, useParams } from "react-router-dom"; import { useQuery } from "@tanstack/react-query"; import { getReview } from "@/lib/api/review/index.ts"; -import { TEAM_REVIEW_INFO, emojis } from "@/lib/mock/review/teamReview.ts"; +import { emojis } from "@/lib/mock/review/teamReview.ts"; +import { MemberReviewType, StudyReviewType } from "@/lib/api/review/type"; interface ReviewModalProps { onClose: () => void; @@ -31,6 +32,33 @@ export default function ReviewModal({ onClose, postId }: ReviewModalProps) { queryFn: () => getReview(postId), }); + const handleUniqueTags = (tagList: { type: string; content: string }[] | undefined) => { + const uniqueTags = new Map(); + + tagList?.forEach((tag) => { + const key = `${tag.type}-${tag.content}`; + if (uniqueTags.has(key)) { + uniqueTags.get(key).count++; + } else { + uniqueTags.set(key, { type: tag.type, content: tag.content, count: 1 }); + } + }); + + const uniqueTagArray = Array.from(uniqueTags.values()); + + uniqueTagArray.sort((a, b) => { + if (a.type === "COMPLIMENT" && b.type !== "COMPLIMENT") { + return -1; + } else if (a.type !== "COMPLIMENT" && b.type === "COMPLIMENT") { + return 1; + } else { + return 0; + } + }); + + return uniqueTagArray; + }; + return ( @@ -48,16 +76,16 @@ export default function ReviewModal({ onClose, postId }: ReviewModalProps) {
스터디 태그 모음
- {data?.postReviews.map((tag) => ( - + {handleUniqueTags(data?.postReviews).map((tag, index) => ( + ))}
내가 받은 태그
- {data?.memberReviews.map((tag) => ( - + {handleUniqueTags(data?.memberReviews).map((tag, index) => ( + ))}
From 18cd160d6d5dea155d992c400f5722c880699561 Mon Sep 17 00:00:00 2001 From: JISOO Date: Wed, 17 Apr 2024 22:44:23 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Design:=ED=83=9C=EA=B7=B8=20=EC=B9=A9=20css?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- co-kkiri/src/components/commons/Chips/EvaluationChip.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/co-kkiri/src/components/commons/Chips/EvaluationChip.tsx b/co-kkiri/src/components/commons/Chips/EvaluationChip.tsx index 3ddde270..1b6d0ed8 100644 --- a/co-kkiri/src/components/commons/Chips/EvaluationChip.tsx +++ b/co-kkiri/src/components/commons/Chips/EvaluationChip.tsx @@ -25,6 +25,8 @@ const EvaluationChipStyle = css` padding: 0.35rem 1.2rem; height: 2.2rem; border-radius: 9.9rem; + dispaly: flex; + gap: 0.4rem; `; const VARIANT_STYLE: VariantStyle = {