From e57935a4b5e8be0be5d5e442ae3b2c5f783f66c2 Mon Sep 17 00:00:00 2001 From: perf3ct Date: Thu, 26 Jun 2025 18:49:24 +0000 Subject: [PATCH] feat(client): update the messy search --- frontend/src/pages/SearchPage.tsx | 130 +++++++++++++++--------------- 1 file changed, 66 insertions(+), 64 deletions(-) diff --git a/frontend/src/pages/SearchPage.tsx b/frontend/src/pages/SearchPage.tsx index b3db44a..2c61683 100644 --- a/frontend/src/pages/SearchPage.tsx +++ b/frontend/src/pages/SearchPage.tsx @@ -42,8 +42,6 @@ import { FilterList as FilterIcon, Clear as ClearIcon, ExpandMore as ExpandMoreIcon, - GridView as GridViewIcon, - ViewList as ListViewIcon, Download as DownloadIcon, PictureAsPdf as PdfIcon, Image as ImageIcon, @@ -108,7 +106,6 @@ interface SearchFilters { hasOcr?: string; } -type ViewMode = 'grid' | 'list'; type SearchMode = 'simple' | 'phrase' | 'fuzzy' | 'boolean'; type OcrStatus = 'all' | 'yes' | 'no'; @@ -133,7 +130,6 @@ const SearchPage: React.FC = () => { const [searchResults, setSearchResults] = useState([]); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); - const [viewMode, setViewMode] = useState('grid'); const [queryTime, setQueryTime] = useState(0); const [totalResults, setTotalResults] = useState(0); const [suggestions, setSuggestions] = useState([]); @@ -447,11 +443,6 @@ const SearchPage: React.FC = () => { setSearchQuery(suggestion); }; - const handleViewModeChange = (event: React.MouseEvent, newView: ViewMode | null): void => { - if (newView) { - setViewMode(newView); - } - }; const handleSearchModeChange = (event: React.MouseEvent, newMode: SearchMode | null): void => { if (newMode) { @@ -894,31 +885,12 @@ const SearchPage: React.FC = () => { {/* Search Results */} - {/* Toolbar */} + {/* Results Header */} {searchQuery && ( - + {loading ? 'Searching...' : `${searchResults.length} results found`} - - - - - - - - - )} @@ -1044,14 +1016,11 @@ const SearchPage: React.FC = () => { )} {!loading && !error && searchResults.length > 0 && ( - + {searchResults.map((doc) => ( { sx={{ height: '100%', display: 'flex', - flexDirection: viewMode === 'list' ? 'row' : 'column', + flexDirection: 'row', }} > - {viewMode === 'grid' && ( - - + + + + {getFileIcon(doc.mime_type)} - - )} - - - - {viewMode === 'list' && ( - - {getFileIcon(doc.mime_type)} - - )} { sx={{ fontSize: '0.95rem', fontWeight: 600, - mb: 1, + mb: 0.5, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', @@ -1104,7 +1072,13 @@ const SearchPage: React.FC = () => { {doc.original_filename} - + { {doc.tags.length > 0 && ( - + {doc.tags.slice(0, 2).map((tag, index) => ( { {/* Enhanced Search Snippets */} {doc.snippets && doc.snippets.length > 0 && ( - + { {/* Search Rank */} {doc.search_rank && ( - + { )} - + navigate(`/documents/${doc.id}`)} > - + handleDownload(doc)} > - +