// src/pages/IssueViewerPage.tsx import { useState, useEffect } from "react"; import { useParams } from "react-router-dom"; import { getIssues, type Issue } from "@/services/issue"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@/components/ui/table"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { ErrorDisplay } from "@/components/ErrorDisplay"; // 테이블 헤더 정의 const issueTableHeaders = [ { key: "title", label: "Title" }, { key: "feedbackCount", label: "Feedback Count" }, { key: "description", label: "Description" }, { key: "status", label: "Status" }, { key: "createdAt", label: "Created" }, { key: "updatedAt", label: "Updated" }, { key: "category", label: "Category" }, ]; export function IssueViewerPage() { const { projectId } = useParams<{ projectId: string }>(); const [issues, setIssues] = useState([]); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); useEffect(() => { if (!projectId) return; setLoading(true); setError(null); getIssues(projectId) .then(setIssues) .catch((err) => setError((err as Error).message)) .finally(() => setLoading(false)); }, [projectId]); return (

이슈 뷰어

프로젝트: {projectId}

{error && } 이슈 목록 {loading &&

로딩 중...

} {!loading && (
{issueTableHeaders.map((header) => ( {header.label} ))} {issues.length > 0 ? ( issues.map((issue) => ( {issueTableHeaders.map((header) => ( {String(issue[header.key] ?? "")} ))} )) ) : ( 표시할 이슈가 없습니다. )}
)}
); }