From 1164757b8ff4d8aaee61815c1bff436c02b12d6a Mon Sep 17 00:00:00 2001 From: jhynsoo Date: Wed, 2 Oct 2024 10:54:01 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EB=A6=AC=EB=B7=B0=20=EC=83=81=ED=83=9C?= =?UTF-8?q?=20=EA=B0=92=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/reviewApi.ts | 4 ++-- frontend/src/api/workspaceApi.ts | 3 ++- frontend/src/components/ReviewList/ReviewItem.tsx | 3 ++- frontend/src/components/ReviewList/index.tsx | 6 +++--- frontend/src/mocks/reviewHandlers.ts | 4 ++-- frontend/src/pages/ProjectReviewList.tsx | 3 ++- frontend/src/pages/ReviewDetail.tsx | 4 ++-- frontend/src/pages/WorkspaceReviewList.tsx | 3 ++- frontend/src/queries/reviews/useReviewByStatusQuery.ts | 4 ++-- .../src/queries/workspaces/useWorkspaceReviewsQuery.tsx | 4 ++-- frontend/src/types/reviewTypes.ts | 8 +++++--- 11 files changed, 26 insertions(+), 20 deletions(-) diff --git a/frontend/src/api/reviewApi.ts b/frontend/src/api/reviewApi.ts index d42974b..964f8c8 100644 --- a/frontend/src/api/reviewApi.ts +++ b/frontend/src/api/reviewApi.ts @@ -1,5 +1,5 @@ import api from '@/api/axiosConfig'; -import { ReviewDetailResponse, ReviewRequest, ReviewResponse } from '@/types'; +import { ReviewDetailResponse, ReviewRequest, ReviewResponse, ReviewStatus } from '@/types'; // 리뷰 단건 조회 export async function getReviewDetail(projectId: number, reviewId: number, memberId: number) { @@ -49,7 +49,7 @@ export async function getReviewByStatus( projectId: number, memberId: number, sortDirection: number, - reviewStatus?: 'REQUESTED' | 'APPROVED' | 'REJECTED', + reviewStatus?: ReviewStatus, lastReviewId?: number, limitPage: number = 10 ) { diff --git a/frontend/src/api/workspaceApi.ts b/frontend/src/api/workspaceApi.ts index 9ff1bed..08480a1 100644 --- a/frontend/src/api/workspaceApi.ts +++ b/frontend/src/api/workspaceApi.ts @@ -5,6 +5,7 @@ import { WorkspaceResponse, ReviewResponse, WorkspaceMemberResponse, + ReviewStatus, } from '@/types'; export async function getWorkspaceList(memberId: number, lastWorkspaceId?: number, limit?: number) { @@ -59,7 +60,7 @@ export async function getWorkspaceReviews( workspaceId: number, memberId: number, sortDirection: number, - reviewStatus?: 'REQUESTED' | 'APPROVED' | 'REJECTED', + reviewStatus?: ReviewStatus, lastReviewId?: number, limitPage: number = 10 ) { diff --git a/frontend/src/components/ReviewList/ReviewItem.tsx b/frontend/src/components/ReviewList/ReviewItem.tsx index 3e599e1..a840d02 100644 --- a/frontend/src/components/ReviewList/ReviewItem.tsx +++ b/frontend/src/components/ReviewList/ReviewItem.tsx @@ -2,13 +2,14 @@ import { Briefcase, Tag, Box, Layers } from 'lucide-react'; import { Link } from 'react-router-dom'; import useProjectQuery from '@/queries/projects/useProjectQuery'; import useAuthStore from '@/stores/useAuthStore'; +import { ReviewStatus } from '@/types'; interface ReviewItemProps { title: string; createdTime: string; creatorName: string; projectId: number; - status: 'REQUESTED' | 'APPROVED' | 'REJECTED'; + status: ReviewStatus; type?: { text: 'classification' | 'detection' | 'segmentation'; color: string }; workspaceId: number; reviewId: number; diff --git a/frontend/src/components/ReviewList/index.tsx b/frontend/src/components/ReviewList/index.tsx index dc6e7f7..fa4ed49 100644 --- a/frontend/src/components/ReviewList/index.tsx +++ b/frontend/src/components/ReviewList/index.tsx @@ -1,11 +1,11 @@ import ReviewItem from './ReviewItem'; import ReviewSearchInput from './ReviewSearchInput'; -import { ReviewResponse } from '@/types'; +import { ReviewResponse, ReviewStatus } from '@/types'; interface ReviewListProps { reviews: ReviewResponse[]; - activeTab: 'REQUESTED' | 'APPROVED' | 'REJECTED' | 'all'; - setActiveTab: React.Dispatch>; + activeTab: ReviewStatus | 'all'; + setActiveTab: React.Dispatch>; setSearchQuery: React.Dispatch>; sortValue: string; setSortValue: React.Dispatch>; diff --git a/frontend/src/mocks/reviewHandlers.ts b/frontend/src/mocks/reviewHandlers.ts index 72372e4..d5b54f1 100644 --- a/frontend/src/mocks/reviewHandlers.ts +++ b/frontend/src/mocks/reviewHandlers.ts @@ -1,5 +1,5 @@ import { http, HttpResponse } from 'msw'; -import { ReviewDetailResponse, ReviewRequest, ReviewResponse, ReviewStatusRequest } from '@/types'; +import { ReviewDetailResponse, ReviewRequest, ReviewResponse, ReviewStatus, ReviewStatusRequest } from '@/types'; export const reviewHandlers = [ // 리뷰 단건 조회 핸들러 @@ -145,7 +145,7 @@ export const reviewHandlers = [ reviewId: index + 1, title: `Review ${index + 1}`, content: `Review content ${index + 1}`, - status: (reviewStatus || 'REQUESTED') as 'REQUESTED' | 'APPROVED' | 'REJECTED', + status: (reviewStatus || 'REQUESTED') as ReviewStatus, createAt: new Date().toISOString(), updateAt: new Date().toISOString(), author: { id: 1, nickname: 'Author', profileImage: '', email: 'author@example.com' }, diff --git a/frontend/src/pages/ProjectReviewList.tsx b/frontend/src/pages/ProjectReviewList.tsx index b213701..f0b18bf 100644 --- a/frontend/src/pages/ProjectReviewList.tsx +++ b/frontend/src/pages/ProjectReviewList.tsx @@ -4,13 +4,14 @@ import useReviewByStatusQuery from '@/queries/reviews/useReviewByStatusQuery'; import useAuthStore from '@/stores/useAuthStore'; import ReviewList from '@/components/ReviewList'; import { Button } from '@/components/ui/button'; +import { ReviewStatus } from '@/types'; export default function ProjectReviewList() { const { workspaceId, projectId } = useParams<{ workspaceId: string; projectId: string }>(); const profile = useAuthStore((state) => state.profile); const memberId = profile?.id || 0; - const [activeTab, setActiveTab] = useState<'REQUESTED' | 'APPROVED' | 'REJECTED' | 'all'>('REQUESTED'); + const [activeTab, setActiveTab] = useState('REQUESTED'); const [, setSearchQuery] = useState(''); const [sortValue, setSortValue] = useState('latest'); diff --git a/frontend/src/pages/ReviewDetail.tsx b/frontend/src/pages/ReviewDetail.tsx index 210a275..c909f1e 100644 --- a/frontend/src/pages/ReviewDetail.tsx +++ b/frontend/src/pages/ReviewDetail.tsx @@ -111,7 +111,7 @@ export default function ReviewDetail(): JSX.Element { )} - {(reviewDetail.reviewStatus === 'APPROVED' || reviewDetail.reviewStatus === 'REJECTED') && ( + {(reviewDetail.reviewStatus === 'APPROVED' || reviewDetail.reviewStatus === 'REJECT') && (

리뷰 상태: {reviewDetail.reviewStatus === 'APPROVED' ? '승인됨' : '거부됨'} @@ -137,7 +137,7 @@ export default function ReviewDetail(): JSX.Element { - {isAdminOrManager && reviewDetail.reviewStatus !== 'APPROVED' && reviewDetail.reviewStatus !== 'REJECTED' && ( + {isAdminOrManager && reviewDetail.reviewStatus !== 'APPROVED' && reviewDetail.reviewStatus !== 'REJECT' && ( <>