diff --git a/frontend/src/components/ReviewDetail/index.tsx b/frontend/src/components/ReviewDetail/index.tsx index c9dc42d..c0d3690 100644 --- a/frontend/src/components/ReviewDetail/index.tsx +++ b/frontend/src/components/ReviewDetail/index.tsx @@ -1,86 +1,152 @@ -import useReviewDetailQuery from '@/queries/reviews/useReviewDetailQuery'; -import useUpdateReviewQuery from '@/queries/reviews/useUpdateReviewQuery'; -import useDeleteReviewQuery from '@/queries/reviews/useDeleteReviewQuery'; +import { useState } from 'react'; import { useParams } from 'react-router-dom'; +import Slider from 'react-slick'; +import useReviewDetailQuery from '@/queries/reviews/useReviewDetailQuery'; +import useUpdateReviewStatusQuery from '@/queries/reviews/useUpdateReviewStatusQuery'; +import useProjectMembersQuery from '@/queries/projects/useProjectMembersQuery'; +import useAuthStore from '@/stores/useAuthStore'; +import { Button } from '@/components/ui/button'; +import 'slick-carousel/slick/slick.css'; +import 'slick-carousel/slick/slick-theme.css'; -export default function ReviewDetail() { +export default function ReviewDetail(): JSX.Element { const { projectId, reviewId } = useParams<{ projectId: string; reviewId: string }>(); - const memberId = 1; + const profile = useAuthStore((state) => state.profile); + const memberId = profile?.id || 0; const { data: reviewDetail } = useReviewDetailQuery(Number(projectId), Number(reviewId), memberId); - const updateReview = useUpdateReviewQuery(); - const deleteReview = useDeleteReviewQuery(); + const { data: projectMembers } = useProjectMembersQuery(Number(projectId), memberId); - const handleUpdate = () => { - updateReview.mutate({ + const updateReviewStatus = useUpdateReviewStatusQuery(); + const [activeTab, setActiveTab] = useState<'content' | 'images'>('content'); + + const handleApprove = () => { + updateReviewStatus.mutate({ projectId: Number(projectId), reviewId: Number(reviewId), memberId, - reviewData: { - title: reviewDetail.title, - content: reviewDetail.content, - imageIds: reviewDetail.images.map((image) => image.id), - }, + reviewStatus: 'APPROVED', }); }; - const handleDelete = () => { - deleteReview.mutate({ + const handleReject = () => { + updateReviewStatus.mutate({ projectId: Number(projectId), reviewId: Number(reviewId), memberId, + reviewStatus: 'REJECTED', }); }; - if (!reviewDetail) return
Loading...
; - - const { title, content, reviewStatus, images } = reviewDetail; + const settings = { + dots: true, + infinite: true, + speed: 500, + slidesToShow: 1, + slidesToScroll: 1, + }; return ( -by 김용수
-|
-8 hours ago
++ 작성자: {reviewDetail.nickname} ({reviewDetail.email}) +
+작성일: {new Date(reviewDetail.createAt).toLocaleDateString()}
+수정일: {new Date(reviewDetail.updateAt).toLocaleDateString()}
{content}
-{reviewDetail.content}
+ ) : ( +이미지가 없습니다.
+ )} +{reviewDetail.reviewerNickname}
+{reviewDetail.reviewerEmail}
+