From 7cc0a3620e026780bc78b8716f72d500acf94ce1 Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Thu, 20 Feb 2025 03:33:35 +0530 Subject: [PATCH] (fix:docs) consistency --- frontend/src/settings/Documents.tsx | 222 ++++++++++++++-------------- 1 file changed, 108 insertions(+), 114 deletions(-) diff --git a/frontend/src/settings/Documents.tsx b/frontend/src/settings/Documents.tsx index d6b7dd3f..a8447296 100644 --- a/frontend/src/settings/Documents.tsx +++ b/frontend/src/settings/Documents.tsx @@ -176,7 +176,7 @@ export default function Documents({ }} /> ) : ( -
+

@@ -213,117 +213,117 @@ export default function Documents({ {t('settings.documents.addNew')}

- -
- {' '} +
- - - - - - setShowDocumentChunks(document)} + > + + + + + + )) + )} + +
- {t('settings.documents.name')} - -
- {t('settings.documents.date')} - refreshDocs('date')} - src={caretSort} - alt="sort" - /> -
-
-
- - {t('settings.documents.tokenUsage')} +
+ + + + + + + - - - - - {loading ? ( - - ) : !currentDocuments?.length ? ( - - + - ) : ( - currentDocuments.map((document, index) => ( - setShowDocumentChunks(document)} - > + + + {loading ? ( + + ) : !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')} -
- {document.name} - - {document.date ? formatDate(document.date) : ''} - - {document.tokens ? formatTokens(+document.tokens) : ''} - -
- {!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} + /> + )} + +
+
+
@@ -352,15 +352,9 @@ export default function Documents({ isOnboarding={isOnboarding} renderTab={null} close={() => setModalState('INACTIVE')} - onSuccessfulUpload={() => { - getDocs() - .then((data) => { - dispatch(setSourceDocs(data)); - // Then refresh paginated documents - return refreshDocs(undefined, currentPage, rowsPerPage); - }) - .catch((error) => console.error('Error updating docs:', error)); - }} + onSuccessfulUpload={() => + refreshDocs(undefined, currentPage, rowsPerPage) + } /> )}