From 16608370a6c03e9beac666eafb8791fae9a4c0f9 Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Mon, 27 Jan 2025 03:01:39 +0530 Subject: [PATCH] (feat:settings)docs table design perfection --- frontend/src/settings/Documents.tsx | 242 ++++++++++++++-------------- 1 file changed, 124 insertions(+), 118 deletions(-) diff --git a/frontend/src/settings/Documents.tsx b/frontend/src/settings/Documents.tsx index ee52b377..e33a5214 100644 --- a/frontend/src/settings/Documents.tsx +++ b/frontend/src/settings/Documents.tsx @@ -15,7 +15,6 @@ import { Doc, DocumentsProps, ActiveState } from '../models/misc'; // Ensure Act import { getDocs, getDocsWithPagination } from '../preferences/preferenceApi'; import { setSourceDocs } from '../preferences/preferenceSlice'; import { setPaginatedDocuments } from '../preferences/preferenceSlice'; -import { truncate } from '../utils/stringUtils'; import { formatDate } from '../utils/dateTimeUtils'; // Utility function to format numbers @@ -146,8 +145,8 @@ const Documents: React.FC = ({ }, [searchTerm]); return ( -
-
+
+

{t('settings.documents.title')} @@ -186,128 +185,135 @@ const Documents: React.FC = ({ {loading ? ( ) : ( -
- - - - - - + + + + + + )) + )} + +
- {t('settings.documents.name')} - -
- {t('settings.documents.date')} - refreshDocs('date')} - src={caretSort} - alt="sort" - /> -
-
-
- - {t('settings.documents.tokenUsage')} +
+ {' '} + {/* Removed overflow-auto */} +
+ + + + + + + - - - - - {!currentDocuments?.length && ( - - + - )} - {Array.isArray(currentDocuments) && - currentDocuments.map((document, index) => ( - - - - - + {!currentDocuments?.length ? ( + + - ))} - -
+ {t('settings.documents.name')} + +
+ {t('settings.documents.date')} + refreshDocs('date')} + src={caretSort} + alt="sort" + /> +
+
+
+ + {t('settings.documents.tokenUsage')} + + + {t('settings.documents.tokenUsage')} + + refreshDocs('tokens')} + src={caretSort} + alt="sort" + /> +
+
+ + {t('settings.documents.actions')} - - {t('settings.documents.tokenUsage')} - - refreshDocs('tokens')} - src={caretSort} - alt="sort" - /> - - - - {t('settings.documents.actions')} - -
- {t('settings.documents.noData')} -
-
- {truncate(document.name, 50)} -
-
- {document.date ? formatDate(document.date) : ''} - - {document.tokens ? formatTokens(+document.tokens) : ''} - -
- {/* For non-remote documents, adding empty space holder */} - {!document.syncFrequency && ( -
- )} - {document.syncFrequency && ( - { - handleManageSync(document, value); - }} - defaultValue={document.syncFrequency} - icon={SyncIcon} - /> - )} - -
+ +
+ {t('settings.documents.noData')}
+ ) : ( + currentDocuments.map((document, index) => ( +
+ {document.name} + + {document.date ? formatDate(document.date) : ''} + + {document.tokens + ? formatTokens(+document.tokens) + : ''} + +
+ {!document.syncFrequency && ( +
+ )} + {document.syncFrequency && ( + { + handleManageSync(document, value); + }} + defaultValue={document.syncFrequency} + icon={SyncIcon} + /> + )} + +
+
+

)}
- { - setCurrentPage(page); - refreshDocs(undefined, page, rowsPerPage); - }} - onRowsPerPageChange={(rows) => { - setRowsPerPage(rows); - setCurrentPage(1); - refreshDocs(undefined, 1, rows); - }} - /> + +
+ { + setCurrentPage(page); + refreshDocs(undefined, page, rowsPerPage); + }} + onRowsPerPageChange={(rows) => { + setRowsPerPage(rows); + setCurrentPage(1); + refreshDocs(undefined, 1, rows); + }} + /> +
+ {modalState === 'ACTIVE' && (