import React from 'react'; import { OcrDocument, OcrDocumentStatus } from '../../types'; interface OcrDocumentsTableProps { documents: OcrDocument[]; onReview: (doc: OcrDocument) => void; } const statusConfig: { [key in OcrDocumentStatus]: { text: string; color: string; icon: string } } = { Processing: { text: 'Memproses', color: 'bg-blue-100 text-blue-700', icon: 'fa-spin fa-spinner', }, 'Needs Review': { text: 'Perlu Tinjauan', color: 'bg-yellow-100 text-yellow-700', icon: 'fa-user-check', }, Completed: { text: 'Selesai', color: 'bg-green-100 text-green-700', icon: 'fa-check-circle' }, Failed: { text: 'Gagal', color: 'bg-red-100 text-red-700', icon: 'fa-times-circle' }, }; const OcrDocumentsTable: React.FC = ({ documents, onReview }) => { const sortedDocs = [...documents].sort((a, b) => b.uploadedAt.getTime() - a.uploadedAt.getTime()); return (

Dokumen Terproses

{sortedDocs.map((doc) => { const config = statusConfig[doc.status]; const accuracyColor = doc.accuracy > 95 ? 'text-green-600' : doc.accuracy > 80 ? 'text-yellow-600' : 'text-red-600'; return ( ); })}
Nama File Waktu Unggah Jenis Dokumen Akurasi Status Aksi
{doc.fileName} {doc.uploadedAt.toLocaleString('id-ID')} {doc.documentType} {doc.accuracy > 0 ? `${doc.accuracy}%` : '-'} {config.text} {(doc.status === 'Needs Review' || doc.status === 'Completed') && ( )}
); }; export default OcrDocumentsTable;