From a223ef1f32156dca5b5cfb02af34f864d91bf671 Mon Sep 17 00:00:00 2001 From: Hojin Date: Tue, 9 Jan 2024 08:44:25 +0900 Subject: [PATCH 1/7] =?UTF-8?q?Feat:=20=EC=97=AC=EC=A0=95=20API=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/trips.ts | 56 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/src/api/trips.ts b/src/api/trips.ts index 1294dbad..92bfa681 100644 --- a/src/api/trips.ts +++ b/src/api/trips.ts @@ -2,15 +2,15 @@ import client from './client'; // 여정 관련 API -// 나의 여정 목록조회 -export const getTrips = async (page: number, size: number) => { - const res = await client.get(`trips?page=${page}&size=${size}`); +// 여정 상세조회 +export const getTrips = async (tripId: number) => { + const res = await client.get(`trips/${tripId}`); return res; }; -// 여정 생성 -export const postTrips = async (tripsData: TripRequest) => { - const res = await client.post(`trips`, tripsData); +// 여정 기본정보 수정 +export const putTrips = async (tripId: number, tripsData: TripRequest) => { + const res = await client.put(`trips/${tripId}`, tripsData); return res; }; @@ -19,3 +19,47 @@ export const deleteTrips = async (tripId: number) => { const res = await client.delete(`trips/${tripId}`); return res; }; + +// 여정 생성 +export const postTrips = async (tripsData: TripRequest) => { + const res = await client.post(`trips`, tripsData); + return res; +}; + +// 우리의 관심목록 조회 +export const getTripsLike = async ( + tripId: number, + category: number, + page: number, + size: number, +) => { + const res = await client.get( + `trips/${tripId}/tripLikedTours?category=${category}&page=${page}$size=${size}`, + ); + return res; +}; + +// 우리의 관심 여행지 등록 +// 요청바디 추가필요 +export const postTripsLike = async (tripId: number) => { + const res = await client.post(`trips/${tripId}/tripLikedTours`); + return res; +}; + +// 우리의 관심 여행지 좋아요/싫어요 +export const postTripsLikeHate = async ( + tripId: number, + tourId: number, + prefer: boolean, +) => { + const res = await client.post( + `trips/${tripId}/tripLikedTours/${tourId}?prefer=${prefer}`, + ); + return res; +}; + +// 우리의 여행취향 조회 +export const getTripsSurvey = async (tripId: number) => { + const res = await client.get(`trips/${tripId}/survey`); + return res; +}; From 712239695e02f7d291d5372153d5e712e5fdf7d2 Mon Sep 17 00:00:00 2001 From: Hojin Date: Tue, 9 Jan 2024 19:45:27 +0900 Subject: [PATCH 2/7] =?UTF-8?q?Feat:=20=EC=95=84=EC=BD=94=EB=94=94?= =?UTF-8?q?=EC=96=B8=20=EA=B3=B5=ED=86=B5=EC=BB=B4=ED=8F=AC=EB=84=8C?= =?UTF-8?q?=ED=8A=B8=20=EA=B5=AC=ED=98=84,=20=EC=9D=B4=EB=9F=B0=EC=A0=90?= =?UTF-8?q?=EC=9D=B4=20=EC=A2=8B=EC=95=98=EC=96=B4=EC=9A=94=20count=20?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=EC=95=84=EC=9B=83=20=EB=A6=AC=ED=8E=99?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + pnpm-lock.yaml | 32 +++++++++++++++++++ .../DetailSectionBottom/DetailReviewStats.tsx | 12 +++---- src/components/common/accordion/Accordion.tsx | 25 +++++++++++++++ src/components/common/icons/Icons.tsx | 2 ++ src/index.css | 10 ++++++ 6 files changed, 75 insertions(+), 7 deletions(-) create mode 100644 src/components/common/accordion/Accordion.tsx diff --git a/package.json b/package.json index 2af0d0d1..48e0614e 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ }, "dependencies": { "@pnpm-monorepo/shared": "^1.0.0", + "@radix-ui/react-accordion": "^1.1.2", "@radix-ui/react-collapsible": "^1.0.3", "@radix-ui/react-dialog": "^1.0.5", "@radix-ui/react-icons": "^1.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 12b2de0d..4c25bcdb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,9 @@ dependencies: '@pnpm-monorepo/shared': specifier: ^1.0.0 version: 1.0.0 + '@radix-ui/react-accordion': + specifier: ^1.1.2 + version: 1.1.2(@types/react-dom@18.2.18)(@types/react@18.2.45)(react-dom@18.2.0)(react@18.2.0) '@radix-ui/react-collapsible': specifier: ^1.0.3 version: 1.0.3(@types/react-dom@18.2.18)(@types/react@18.2.45)(react-dom@18.2.0)(react@18.2.0) @@ -1824,6 +1827,35 @@ packages: '@babel/runtime': 7.23.6 dev: false + /@radix-ui/react-accordion@1.1.2(@types/react-dom@18.2.18)(@types/react@18.2.45)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-fDG7jcoNKVjSK6yfmuAs0EnPDro0WMXIhMtXdTBWqEioVW206ku+4Lw07e+13lUkFkpoEQ2PdeMIAGpdqEAmDg==} + peerDependencies: + '@types/react': '*' + '@types/react-dom': '*' + react: ^16.8 || ^17.0 || ^18.0 + react-dom: ^16.8 || ^17.0 || ^18.0 + peerDependenciesMeta: + '@types/react': + optional: true + '@types/react-dom': + optional: true + dependencies: + '@babel/runtime': 7.23.6 + '@radix-ui/primitive': 1.0.1 + '@radix-ui/react-collapsible': 1.0.3(@types/react-dom@18.2.18)(@types/react@18.2.45)(react-dom@18.2.0)(react@18.2.0) + '@radix-ui/react-collection': 1.0.3(@types/react-dom@18.2.18)(@types/react@18.2.45)(react-dom@18.2.0)(react@18.2.0) + '@radix-ui/react-compose-refs': 1.0.1(@types/react@18.2.45)(react@18.2.0) + '@radix-ui/react-context': 1.0.1(@types/react@18.2.45)(react@18.2.0) + '@radix-ui/react-direction': 1.0.1(@types/react@18.2.45)(react@18.2.0) + '@radix-ui/react-id': 1.0.1(@types/react@18.2.45)(react@18.2.0) + '@radix-ui/react-primitive': 1.0.3(@types/react-dom@18.2.18)(@types/react@18.2.45)(react-dom@18.2.0)(react@18.2.0) + '@radix-ui/react-use-controllable-state': 1.0.1(@types/react@18.2.45)(react@18.2.0) + '@types/react': 18.2.45 + '@types/react-dom': 18.2.18 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + dev: false + /@radix-ui/react-collapsible@1.0.3(@types/react-dom@18.2.18)(@types/react@18.2.45)(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-UBmVDkmR6IvDsloHVN+3rtx4Mi5TFvylYXpluuv0f37dtaz3H99bp8No0LGXRigVpl3UAT4l9j6bIchh42S/Gg==} peerDependencies: diff --git a/src/components/DetailSectionBottom/DetailReviewStats.tsx b/src/components/DetailSectionBottom/DetailReviewStats.tsx index 9a1ade3a..c428443c 100644 --- a/src/components/DetailSectionBottom/DetailReviewStats.tsx +++ b/src/components/DetailSectionBottom/DetailReviewStats.tsx @@ -24,14 +24,12 @@ const DetailReviewStats = () => { backgroundColor: getColor(data.keywordCount), }} /> -
-
-

{getEmoji(data.content)}

-

- {data.content} -

+
+
+

{getEmoji(data.content)}

+

{data.content}

-

{data.keywordCount}

+

{data.keywordCount}

diff --git a/src/components/common/accordion/Accordion.tsx b/src/components/common/accordion/Accordion.tsx new file mode 100644 index 00000000..aa63b805 --- /dev/null +++ b/src/components/common/accordion/Accordion.tsx @@ -0,0 +1,25 @@ +import * as accordion from '@radix-ui/react-accordion'; +import { CheckIcon } from '../icons/Icons'; + +interface AccordionProps { + title: React.ReactNode; + content: React.ReactNode; +} + +const Accordion: React.FC = ({ title, content }) => { + return ( + + + + {title} + + + + + {content} + + + ); +}; + +export default Accordion; diff --git a/src/components/common/icons/Icons.tsx b/src/components/common/icons/Icons.tsx index 73b09c65..fc167495 100644 --- a/src/components/common/icons/Icons.tsx +++ b/src/components/common/icons/Icons.tsx @@ -174,11 +174,13 @@ export const CheckIcon: React.FC = ({ fill = 'none', onClick, cursor = 'pointer', + className, }) => { return ( Date: Tue, 9 Jan 2024 19:49:20 +0900 Subject: [PATCH 3/7] =?UTF-8?q?Feat:=20=EC=9A=B0=EB=A6=AC=EC=9D=98=20?= =?UTF-8?q?=EA=B4=80=EC=8B=AC=20=EC=97=AC=ED=96=89=EC=A7=80=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=20=EC=9A=94=EC=B2=AD=EB=8D=B0=EC=9D=B4=ED=84=B0=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/trips.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/api/trips.ts b/src/api/trips.ts index 92bfa681..7d7aeb81 100644 --- a/src/api/trips.ts +++ b/src/api/trips.ts @@ -40,9 +40,8 @@ export const getTripsLike = async ( }; // 우리의 관심 여행지 등록 -// 요청바디 추가필요 -export const postTripsLike = async (tripId: number) => { - const res = await client.post(`trips/${tripId}/tripLikedTours`); +export const postTripsLike = async (tripId: number, tourItemIds: number[]) => { + const res = await client.post(`trips/${tripId}/tripLikedTours`, tourItemIds); return res; }; From 0bc56a24e786a4afd5b0c9695151dac8033af95e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=96=B4=EC=8A=B9=EC=A4=80?= Date: Tue, 9 Jan 2024 23:45:15 +0900 Subject: [PATCH 4/7] =?UTF-8?q?Fix:=20=ED=86=A0=EC=8A=A4=ED=8A=B8=ED=8C=9D?= =?UTF-8?q?=EC=97=85=20=EC=9C=84=EC=B9=98=20=EC=A1=B0=EC=A0=95=20=EB=B0=8F?= =?UTF-8?q?=20invalidateQueries=20=EC=84=A4=EC=A0=95(=EB=A6=AC=EB=B7=B0?= =?UTF-8?q?=EC=82=AD=EC=A0=9C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailSectionBottom/DetailReviews.tsx | 2 +- .../DetailSectionTop/DetailToursButtons.tsx | 13 ++++++++----- src/components/common/button/Button.tsx | 2 +- src/components/common/modal/Modal.tsx | 2 +- .../common/modal/children/DeleteAlert.tsx | 19 +++++++++++++++---- .../common/toastpopup/ToastPopUp.tsx | 6 +++--- 6 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/components/DetailSectionBottom/DetailReviews.tsx b/src/components/DetailSectionBottom/DetailReviews.tsx index f51a215b..f4ee83f7 100644 --- a/src/components/DetailSectionBottom/DetailReviews.tsx +++ b/src/components/DetailSectionBottom/DetailReviews.tsx @@ -112,7 +112,7 @@ export default function DetailReviews({ reviewData }: reviewProps) { noun: '', verb: '', })); - }, 2000); + }, 4000); return () => clearTimeout(timer); } }, [alert]); diff --git a/src/components/DetailSectionTop/DetailToursButtons.tsx b/src/components/DetailSectionTop/DetailToursButtons.tsx index bc13a706..406384ff 100644 --- a/src/components/DetailSectionTop/DetailToursButtons.tsx +++ b/src/components/DetailSectionTop/DetailToursButtons.tsx @@ -1,7 +1,8 @@ -import { PenIcon, CalendarIcon } from '@components/common/icons/Icons'; -import { useNavigate, useParams } from 'react-router-dom'; +import { CalendarIcon, PenIcon } from '@components/common/icons/Icons'; import { useEffect } from 'react'; - +import { useNavigate, useParams } from 'react-router-dom'; +import { useSetRecoilState } from 'recoil'; +import { isModifyingReviewState } from '@recoil/review'; interface reviewProps { reviewData: any; } @@ -11,17 +12,19 @@ export default function DetailTourButtons({ reviewData }: reviewProps) { const params = useParams(); const tourItemId = Number(params.id); const navigate = useNavigate(); + const setIsModifyingReview = useSetRecoilState(isModifyingReviewState); const handlePostingReivew = () => { + setIsModifyingReview(false); navigate(`/reviewPosting/${tourItemId}`, { state: { title, contentTypeId }, }); }; - + useEffect(() => { console.log('contentTypeId', contentTypeId); }, [contentTypeId]); - + return (
diff --git a/src/components/common/modal/Modal.tsx b/src/components/common/modal/Modal.tsx index e16a1d74..a98d3d6d 100644 --- a/src/components/common/modal/Modal.tsx +++ b/src/components/common/modal/Modal.tsx @@ -40,7 +40,7 @@ export const getModalStyles = (modalChildren: string) => { bottom: '0', marginRight: '-50%', transform: 'translate(-50%, 0)', - width: '375px', + width: '415px', // 375px + padding 40 (20 20) height: '186px', borderTopLeftRadius: '2rem', borderTopRightRadius: '2rem', diff --git a/src/components/common/modal/children/DeleteAlert.tsx b/src/components/common/modal/children/DeleteAlert.tsx index 6b8484f7..44370645 100644 --- a/src/components/common/modal/children/DeleteAlert.tsx +++ b/src/components/common/modal/children/DeleteAlert.tsx @@ -8,18 +8,29 @@ import { } from '@recoil/review'; import { useNavigate } from 'react-router-dom'; import { useRecoilValue, useSetRecoilState } from 'recoil'; +import { useMutation, useQueryClient } from '@tanstack/react-query'; + const DeleteAlert = ({}) => { const navigate = useNavigate(); const tourItemId = useRecoilValue(tourItemIdState); const targetReviewId = useRecoilValue(targetReviewIdState); const setIsModalOpen = useSetRecoilState(isModalOpenState); const setToastPopUp = useSetRecoilState(toastPopUpState); + const queryClient = useQueryClient(); + + const { mutate: deleteReviewMutate } = useMutation({ + mutationFn: (targetReviewId: number) => deleteReview(targetReviewId), + onSuccess: () => { + queryClient.invalidateQueries({ queryKey: ['toursReviews'] }); + }, + onError: () => console.log('error'), + }); const handleDeleteButton = async () => { - await deleteReview(targetReviewId); + await deleteReviewMutate(targetReviewId); setIsModalOpen(false); navigate(`/detail/${tourItemId}`); - window.location.reload(); + // window.location.reload(); setToastPopUp(() => ({ isPopUp: true, noun: '리뷰', @@ -38,10 +49,10 @@ const DeleteAlert = ({}) => { onClick={() => { setIsModalOpen(false); }} - className="text-xs"> + className="text-sm"> 취소 - + 삭제
diff --git a/src/components/common/toastpopup/ToastPopUp.tsx b/src/components/common/toastpopup/ToastPopUp.tsx index f3cba772..6ecc5f01 100644 --- a/src/components/common/toastpopup/ToastPopUp.tsx +++ b/src/components/common/toastpopup/ToastPopUp.tsx @@ -13,7 +13,7 @@ const ToastPopUp: React.FC = ({ noun, verb }) => { useEffect(() => { const timeout = setTimeout(() => { setVisible(false); - }, 2000); + }, 3000); return () => clearTimeout(timeout); }, []); @@ -27,11 +27,11 @@ const ToastPopUp: React.FC = ({ noun, verb }) => { className={`fixed flex items-center px-4 `} style={{ top: '0', - left: '35%', + left: '50%', right: 'auto', bottom: 'auto', marginRight: '-50%', - transform: visible ? 'translateY(0)' : 'translateY(-100%)', + transform: visible ? 'translate(-50%, 0)' : 'translate(-50%, -50%)', width: '375px', height: '64px', borderRadius: '1rem', From 5e52a667ec073836d5a8b075650b0b0e34c3ee8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=96=B4=EC=8A=B9=EC=A4=80?= Date: Wed, 10 Jan 2024 00:06:20 +0900 Subject: [PATCH 5/7] =?UTF-8?q?Fix:=20invalidateQueries=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95(=EB=8C=93=EA=B8=80=EC=83=9D=EC=84=B1/=EC=88=98?= =?UTF-8?q?=EC=A0=95/=EC=82=AD=EC=A0=9C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/modal/children/DeleteAlert.tsx | 1 - .../common/modal/children/EditDelete.tsx | 13 ++++++-- src/components/common/nav/InputComment.tsx | 33 ++++++++++++++++--- 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/src/components/common/modal/children/DeleteAlert.tsx b/src/components/common/modal/children/DeleteAlert.tsx index 44370645..9ae76521 100644 --- a/src/components/common/modal/children/DeleteAlert.tsx +++ b/src/components/common/modal/children/DeleteAlert.tsx @@ -30,7 +30,6 @@ const DeleteAlert = ({}) => { await deleteReviewMutate(targetReviewId); setIsModalOpen(false); navigate(`/detail/${tourItemId}`); - // window.location.reload(); setToastPopUp(() => ({ isPopUp: true, noun: '리뷰', diff --git a/src/components/common/modal/children/EditDelete.tsx b/src/components/common/modal/children/EditDelete.tsx index f93a6907..08c259b7 100644 --- a/src/components/common/modal/children/EditDelete.tsx +++ b/src/components/common/modal/children/EditDelete.tsx @@ -19,6 +19,7 @@ import { import React from 'react'; import { useNavigate } from 'react-router-dom'; import { useRecoilValue, useSetRecoilState } from 'recoil'; +import { useMutation, useQueryClient } from '@tanstack/react-query'; const EditDelete: React.FC = () => { const rating = useRecoilValue(ratingState); @@ -34,6 +35,7 @@ const EditDelete: React.FC = () => { const navigate = useNavigate(); const setIsModalOpen = useSetRecoilState(isModalOpenState); const setModalChildren = useSetRecoilState(modalChildrenState); + const queryClient = useQueryClient(); const handleEdit = () => { if (title == '내 리뷰') { @@ -55,13 +57,20 @@ const EditDelete: React.FC = () => { } }; + const { mutate: deleteCommentMutate } = useMutation({ + mutationFn: (targetCommentId: number) => deleteComments(targetCommentId), + onSuccess: () => { + queryClient.invalidateQueries({ queryKey: ['reviewComments'] }); + }, + onError: () => console.log('error'), + }); + const handleDelete = async () => { if (title === '내 리뷰') { setModalChildren('DeleteAlert'); } else if (title === '내 댓글') { - await deleteComments(targetCommentId); + await deleteCommentMutate(targetCommentId); setIsModalOpen(false); - window.location.reload(); } }; diff --git a/src/components/common/nav/InputComment.tsx b/src/components/common/nav/InputComment.tsx index cb0e2eaf..a6fdd8d3 100644 --- a/src/components/common/nav/InputComment.tsx +++ b/src/components/common/nav/InputComment.tsx @@ -5,11 +5,19 @@ import { commentState } from '@recoil/review'; import { useRecoilState, useRecoilValue } from 'recoil'; import { putComments } from '@api/comments'; import { isModifyingCommentState, targetCommentIdState } from '@recoil/review'; +import { useMutation, useQueryClient } from '@tanstack/react-query'; interface InputCommentProps { classNameName?: string; } - +interface PostCommentMutationParams { + comment: string; + reviewId: number; +} +interface EditCommentMutationParams { + comment: string; + targetCommentId: number; +} export const InputComment: React.FC = () => { const [comment, setComment] = useRecoilState(commentState); const params = useParams(); @@ -18,6 +26,24 @@ export const InputComment: React.FC = () => { isModifyingCommentState, ); const targetCommentId = useRecoilValue(targetCommentIdState); + const queryClient = useQueryClient(); + + const { mutate: postCommentMutate } = useMutation({ + mutationFn: ({ comment, reviewId }: PostCommentMutationParams) => + postComments(comment, reviewId), + onSuccess: () => { + queryClient.invalidateQueries({ queryKey: ['reviewComments'] }); + }, + onError: () => console.log('error'), + }); + const { mutate: editCommentMutate } = useMutation({ + mutationFn: ({ comment, targetCommentId }: EditCommentMutationParams) => + putComments(comment, targetCommentId), + onSuccess: () => { + queryClient.invalidateQueries({ queryKey: ['reviewComments'] }); + }, + onError: () => console.log('error'), + }); const handleTextChange = (event: ChangeEvent) => { const inputText = event.target.value; @@ -26,13 +52,12 @@ export const InputComment: React.FC = () => { const handleSubmit = async () => { if (isModifyingComment) { - await putComments(comment, targetCommentId); + await editCommentMutate({ comment, targetCommentId }); setIsModifyingComment(false); } else { - await postComments(comment, reviewId); + await postCommentMutate({ comment, reviewId }); } setComment(''); - window.location.reload(); }; const handleKeyPress = (event: KeyboardEvent) => { if (event.key === 'Enter') { From 90c7fdc115bd195eb2e79a66f9d12e3fed6f9e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=96=B4=EC=8A=B9=EC=A4=80?= Date: Wed, 10 Jan 2024 02:11:04 +0900 Subject: [PATCH 6/7] =?UTF-8?q?Fix:=20=EB=8C=93=EA=B8=80=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20=EC=8B=9C=20comment=20=EC=B4=88=EA=B8=B0=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DetailSectionBottom/DetailReviews.tsx | 2 +- src/components/common/modal/children/EditDelete.tsx | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/DetailSectionBottom/DetailReviews.tsx b/src/components/DetailSectionBottom/DetailReviews.tsx index f4ee83f7..ec4d9bd9 100644 --- a/src/components/DetailSectionBottom/DetailReviews.tsx +++ b/src/components/DetailSectionBottom/DetailReviews.tsx @@ -112,7 +112,7 @@ export default function DetailReviews({ reviewData }: reviewProps) { noun: '', verb: '', })); - }, 4000); + }, 3500); return () => clearTimeout(timer); } }, [alert]); diff --git a/src/components/common/modal/children/EditDelete.tsx b/src/components/common/modal/children/EditDelete.tsx index 08c259b7..1b859662 100644 --- a/src/components/common/modal/children/EditDelete.tsx +++ b/src/components/common/modal/children/EditDelete.tsx @@ -20,6 +20,7 @@ import React from 'react'; import { useNavigate } from 'react-router-dom'; import { useRecoilValue, useSetRecoilState } from 'recoil'; import { useMutation, useQueryClient } from '@tanstack/react-query'; +import { commentState } from '@recoil/review'; const EditDelete: React.FC = () => { const rating = useRecoilValue(ratingState); @@ -35,6 +36,8 @@ const EditDelete: React.FC = () => { const navigate = useNavigate(); const setIsModalOpen = useSetRecoilState(isModalOpenState); const setModalChildren = useSetRecoilState(modalChildrenState); + const setComment = useSetRecoilState(commentState); + const queryClient = useQueryClient(); const handleEdit = () => { @@ -71,6 +74,7 @@ const EditDelete: React.FC = () => { } else if (title === '내 댓글') { await deleteCommentMutate(targetCommentId); setIsModalOpen(false); + setComment(''); } }; From c92c7506bf82a775a5a94f3a532dcae19d40066d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=96=B4=EC=8A=B9=EC=A4=80?= Date: Wed, 10 Jan 2024 02:46:11 +0900 Subject: [PATCH 7/7] =?UTF-8?q?Fix:=20=ED=82=A4=EC=9B=8C=EB=93=9C=20?= =?UTF-8?q?=EC=97=AC=EB=B0=B1=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DetailSectionBottom/ReviewItem.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/DetailSectionBottom/ReviewItem.tsx b/src/components/DetailSectionBottom/ReviewItem.tsx index 7c34d1f3..5be407af 100644 --- a/src/components/DetailSectionBottom/ReviewItem.tsx +++ b/src/components/DetailSectionBottom/ReviewItem.tsx @@ -172,7 +172,13 @@ const Item: React.FC = (props: ItemProps) => { {showMoreKeywords && Array.from({ length: Math.ceil(keywords.length / 2) }).map( (_, lineIdx) => ( -
+
{keywords .slice(lineIdx * 2, lineIdx * 2 + 2) .map((keyword, idx) => (