diff --git a/frontend/src/pages/FailedOcrPage.tsx b/frontend/src/pages/FailedOcrPage.tsx index 2dad6da..88de1b5 100644 --- a/frontend/src/pages/FailedOcrPage.tsx +++ b/frontend/src/pages/FailedOcrPage.tsx @@ -1,4 +1,5 @@ import React, { useState, useEffect } from 'react'; +import { useNavigate } from 'react-router-dom'; import { Box, Typography, @@ -30,6 +31,7 @@ import { Tab, TextField, useTheme, + Divider, } from '@mui/material'; import Grid from '@mui/material/GridLegacy'; import { @@ -44,9 +46,11 @@ import { FileCopy as FileCopyIcon, Delete as DeleteIcon, FindInPage as FindInPageIcon, + OpenInNew as OpenInNewIcon, } from '@mui/icons-material'; import { format } from 'date-fns'; import { api, documentService } from '../services/api'; +import DocumentViewer from '../components/DocumentViewer'; interface FailedDocument { id: string; @@ -127,6 +131,7 @@ interface DuplicatesResponse { const FailedOcrPage: React.FC = () => { const theme = useTheme(); + const navigate = useNavigate(); const [currentTab, setCurrentTab] = useState(0); const [documents, setDocuments] = useState([]); const [duplicates, setDuplicates] = useState([]); @@ -1028,7 +1033,7 @@ const FailedOcrPage: React.FC = () => { setDetailsOpen(false)} - maxWidth="md" + maxWidth="lg" fullWidth > @@ -1036,74 +1041,122 @@ const FailedOcrPage: React.FC = () => { {selectedDocument && ( - + + {/* File Preview Section */} - - Original Filename: + + File Preview - - {selectedDocument.original_filename} - - - - File Size: - - - {formatFileSize(selectedDocument.file_size)} - - - - MIME Type: - - - {selectedDocument.mime_type} - - - - Tags: - - - {selectedDocument.tags.length > 0 ? ( - selectedDocument.tags.map((tag) => ( - - )) - ) : ( - No tags - )} + { + if (selectedDocument) { + navigate(`/documents/${selectedDocument.id}`); + } + }} + sx={{ + cursor: 'pointer', + border: '2px dashed', + borderColor: 'primary.main', + borderRadius: 2, + p: 1, + transition: 'all 0.2s ease-in-out', + '&:hover': { + borderColor: 'primary.dark', + boxShadow: 2, + }, + }} + > + + + + Click to open full document details page + + + + {/* Document Information Section */} - - Failure Category: + + Document Information - + + + Original Filename: + + + {selectedDocument.original_filename} + - - Retry Count: - - - {selectedDocument.retry_count} attempts - + + File Size: + + + {formatFileSize(selectedDocument.file_size)} + - - Created: - - - {format(new Date(selectedDocument.created_at), 'PPpp')} - + + MIME Type: + + + {selectedDocument.mime_type} + - - Last Updated: - - - {format(new Date(selectedDocument.updated_at), 'PPpp')} - + + Failure Category: + + + + + Retry Count: + + + {selectedDocument.retry_count} attempts + + + + Created: + + + {format(new Date(selectedDocument.created_at), 'PPpp')} + + + + Last Updated: + + + {format(new Date(selectedDocument.updated_at), 'PPpp')} + + + + Tags: + + + {selectedDocument.tags.length > 0 ? ( + selectedDocument.tags.map((tag) => ( + + )) + ) : ( + No tags + )} + + + + {/* Error Details Section */} + + + Error Details + Full Error Message: @@ -1125,6 +1178,17 @@ const FailedOcrPage: React.FC = () => { )} + {selectedDocument?.can_retry && (