From bcf6fcdd359e7f15eb3c2f62d8c2f3267ab61e59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=ED=98=84=EC=A1=B0?= Date: Mon, 9 Sep 2024 17:28:39 +0900 Subject: [PATCH] =?UTF-8?q?Refactor:=20=EB=A6=AC=EB=B7=B0=EB=A6=AC?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EB=8D=94=EB=AF=B8=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EC=B6=94=EA=B0=80(=EC=9E=84=EC=8B=9C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/ReviewList/index.tsx | 57 ++++++++++++++++---- 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/frontend/src/components/ReviewList/index.tsx b/frontend/src/components/ReviewList/index.tsx index 7abaf45..9221fbd 100644 --- a/frontend/src/components/ReviewList/index.tsx +++ b/frontend/src/components/ReviewList/index.tsx @@ -3,11 +3,11 @@ import ReviewItem from './ReviewItem'; import ReviewSearchInput from './ReviewSearchInput'; interface ReviewListProps { - acceptedCount: number; - rejectedCount: number; - pendingCount: number; - totalCount: number; - items: { + acceptedCount?: number; + rejectedCount?: number; + pendingCount?: number; + totalCount?: number; + items?: { title: string; createdTime: string; creatorName: string; @@ -24,18 +24,53 @@ const typeColors: Record<'Classification' | 'Detection' | 'Polygon' | 'Polyline' Polyline: '#c5f9d4', }; +const defaultItems: ReviewListProps['items'] = [ + { + title: '리뷰 항목 1', + createdTime: '2024-09-09T10:00:00Z', + creatorName: '사용자 1', + project: '프로젝트 A', + type: 'Classification', + status: 'needs_review', + }, + { + title: '리뷰 항목 2', + createdTime: '2024-09-08T14:30:00Z', + creatorName: '사용자 2', + project: '프로젝트 B', + type: 'Detection', + status: 'completed', + }, + { + title: '리뷰 항목 3', + createdTime: '2024-09-07T08:45:00Z', + creatorName: '사용자 3', + project: '프로젝트 C', + type: 'Polygon', + status: 'in_progress', + }, + { + title: '리뷰 항목 4', + createdTime: '2024-09-06T10:20:00Z', + creatorName: '사용자 4', + project: '프로젝트 D', + type: 'Polyline', + status: 'pending', + }, +]; + export default function ReviewList({ - acceptedCount, - rejectedCount, - pendingCount, - totalCount, - items, + acceptedCount = 1, + rejectedCount = 1, + pendingCount = 1, + totalCount = 3, + items = defaultItems, }: ReviewListProps): JSX.Element { const [activeTab, setActiveTab] = useState('pending'); const [searchQuery, setSearchQuery] = useState(''); const [sortValue, setSortValue] = useState('latest'); - const filteredItems = items + const filteredItems = (items ?? []) .filter((item) => { if (activeTab === 'pending') return item.status.toLowerCase() === 'needs_review'; if (activeTab === 'accepted') return item.status.toLowerCase() === 'completed';