From c8fdff80694f28d1108c4efdd907fa8a02a3525c Mon Sep 17 00:00:00 2001 From: MEGUMMY1 Date: Fri, 12 Jul 2024 15:24:05 +0900 Subject: [PATCH 1/8] =?UTF-8?q?Feat:=20=EC=98=88=EC=95=BD=20=EB=82=B4?= =?UTF-8?q?=EC=97=AD=EC=9D=98=20=ED=9B=84=EA=B8=B0=20=EC=9E=91=EC=84=B1=20?= =?UTF-8?q?=EB=B2=84=ED=8A=BC=EA=B3=BC=20=ED=9B=84=EA=B8=B0=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1=20=EB=AA=A8=EB=8B=AC=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReservationListCard.tsx | 21 ++-- .../ReservationListCard.types.ts | 5 + components/Review/Review.tsx | 106 ++++++++---------- components/Review/Review.types.ts | 7 ++ pages/review.tsx | 6 - 5 files changed, 74 insertions(+), 71 deletions(-) create mode 100644 components/ReservationListCard/ReservationListCard.types.ts delete mode 100644 pages/review.tsx diff --git a/components/ReservationListCard/ReservationListCard.tsx b/components/ReservationListCard/ReservationListCard.tsx index c6d4f42..ae1fbf3 100644 --- a/components/ReservationListCard/ReservationListCard.tsx +++ b/components/ReservationListCard/ReservationListCard.tsx @@ -1,15 +1,22 @@ import Image from 'next/image'; import { PrimaryButton } from '../Button/Button'; import { statusStyle, statusTitles } from './reservationStatusInfo'; -import { MyReservationList } from './mockData'; import { statusType } from '../ReservationFilter/ReservationFilter.types'; - -interface ReservationCardProps { - mockData: MyReservationList; -} +import { useModal } from '@/hooks/useModal'; +import Review from '../Review/Review'; +import { ReservationCardProps } from './ReservationListCard.types'; const ReservatioListCard = ({ mockData }: ReservationCardProps) => { + const { openModal, closeModal } = useModal(); + const handleCancelReservation = () => {}; + const handleOpenReviewModal = () => { + openModal({ + title: '후기 작성', + hasButton: false, + content: , + }); + }; const isPendingOrAccepted = (status: statusType) => { return status === 'pending' || status === 'accept'; @@ -50,9 +57,9 @@ const ReservatioListCard = ({ mockData }: ReservationCardProps) => { - 후가 작성 + 후기 작성 )} diff --git a/components/ReservationListCard/ReservationListCard.types.ts b/components/ReservationListCard/ReservationListCard.types.ts new file mode 100644 index 0000000..cf25f89 --- /dev/null +++ b/components/ReservationListCard/ReservationListCard.types.ts @@ -0,0 +1,5 @@ +import { MyReservationList } from './mockData'; + +export interface ReservationCardProps { + mockData: MyReservationList; +} diff --git a/components/Review/Review.tsx b/components/Review/Review.tsx index 8c984a3..c0b58d0 100644 --- a/components/Review/Review.tsx +++ b/components/Review/Review.tsx @@ -1,5 +1,4 @@ import React, { useState } from 'react'; -import { useModal } from '@/hooks/useModal'; import Image from 'next/image'; import { PrimaryButton } from '@/components/Button/Button'; import { formatCurrency } from '@/utils/formatCurrency'; @@ -10,9 +9,9 @@ import { ReviewBody, } from '@/pages/api/myReservations/apiMyReservations.types'; import { apiReview } from '@/pages/api/myReservations/apiMyReservations'; +import { ReviewProps } from './Review.types'; -export default function Review({ reservationId }: ReservationId) { - const { openModal } = useModal(); +export default function Review({ reservation, closeModal }: ReviewProps) { const [reviewContent, setReviewContent] = useState(''); const [rating, setRating] = useState(1); @@ -21,6 +20,7 @@ export default function Review({ reservationId }: ReservationId) { apiReview(data.id, data.body), onSuccess: (result) => { console.log('후기 작성 완료: ', result); + closeModal(); }, onError: (error) => { console.error('후기 작성 에러: ', error); @@ -33,67 +33,57 @@ export default function Review({ reservationId }: ReservationId) { content: reviewContent, }; mutation.mutate({ - id: { reservationId }, + id: { reservationId: reservation.id }, body, }); }; return ( <> - - openModal({ - title: '후기 작성', - hasButton: true, - callBackFnc: handleReviewSubmit, - buttonChildren: '작성하기', - content: ( - <> -
- 체험 사진 -
-

- 함께 배우면 즐거운 스트릿 댄스 -

-
-

2023. 2. 14

-

·

-

11:00 - 12:30

-

·

-

10명

-
-
-

- ₩ {formatCurrency(10000)} -

-
-
- setRating(rating)} - currentRating={rating} - /> -
-