diff --git a/frontend/src/components/SkeletonLoader.tsx b/frontend/src/components/SkeletonLoader.tsx index 1b59d610..a73fdd17 100644 --- a/frontend/src/components/SkeletonLoader.tsx +++ b/frontend/src/components/SkeletonLoader.tsx @@ -2,7 +2,7 @@ import { useState, useEffect } from 'react'; interface SkeletonLoaderProps { count?: number; - component?: 'default' | 'analysis' | 'logs' | 'table' | 'chatbot'; + component?: 'default' | 'analysis' | 'logs' | 'table' | 'chatbot' | 'logsTable' | 'dropdown'; } const SkeletonLoader: React.FC = ({ @@ -59,10 +59,7 @@ const SkeletonLoader: React.FC = ({ return ( <> {[...Array(4)].map((_, idx) => ( - +
@@ -81,6 +78,39 @@ const SkeletonLoader: React.FC = ({ ); } + if (component === 'dropdown') { + return ( +
+
+
+
+
+
+
+ ); + } + + if (component === 'logsTable') { + return ( +
+ {[...Array(8)].map((_, idx) => ( +
+
+
+
+
+
+
+
+
+
+ ))} +
+ ); + } return (
@@ -152,7 +182,7 @@ const SkeletonLoader: React.FC = ({
))} - ) : component === 'logs' ? ( + ) : component === 'logs' ? ( <> {[...Array(skeletonCount)].map((_, idx) => (
= ({ }; export default SkeletonLoader; + + diff --git a/frontend/src/settings/Documents.tsx b/frontend/src/settings/Documents.tsx index 98ff7656..e72a6e16 100644 --- a/frontend/src/settings/Documents.tsx +++ b/frontend/src/settings/Documents.tsx @@ -214,122 +214,118 @@ export default function Documents({
- -
- {' '} -
- - - - - - -
- {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" + /> + + + + + + + {loading ? ( + + ) : !currentDocuments?.length ? ( + + - - - {loading ? ( - - ) : !currentDocuments?.length ? ( - + ) : ( + currentDocuments.map((document, index) => ( + setShowDocumentChunks(document)} + > + + + - ) : ( - currentDocuments.map((document, index) => ( - setShowDocumentChunks(document)} - > - - - - - - )) - )} - -
+ {t('settings.documents.name')} + +
+ {t('settings.documents.date')} + refreshDocs('date')} + src={caretSort} + alt="sort" + /> +
+
+
+ + {t('settings.documents.tokenUsage')} -
+ + {t('settings.documents.actions')} + +
+ {t('settings.documents.noData')} +
- {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} + /> + )} + +
- {document.name} - - {document.date ? formatDate(document.date) : ''} - - {document.tokens - ? formatTokens(+document.tokens) - : ''} - -
- {!document.syncFrequency && ( -
- )} - {document.syncFrequency && ( - { - handleManageSync(document, value); - }} - defaultValue={document.syncFrequency} - icon={SyncIcon} - /> - )} - -
-
-
+ )) + )} + +
- +
diff --git a/frontend/src/settings/Logs.tsx b/frontend/src/settings/Logs.tsx index aa4e32a4..d1255b1d 100644 --- a/frontend/src/settings/Logs.tsx +++ b/frontend/src/settings/Logs.tsx @@ -67,16 +67,16 @@ export default function Logs() { return (
-
- - {loadingChatbots ? ( - - ) : ( + {loadingChatbots ? ( + + ) : ( +
+ - )} -
+
+ )}
- {loadingLogs ? ( - - ) : ( - - )} +
); @@ -123,9 +119,10 @@ export default function Logs() { type LogsTableProps = { logs: LogData[]; setPage: React.Dispatch>; + loading: boolean; }; -function LogsTable({ logs, setPage }: LogsTableProps) { +function LogsTable({ logs, setPage, loading }: LogsTableProps) { const { t } = useTranslation(); const observerRef = useRef(); const firstObserver = useCallback((node: HTMLDivElement) => { @@ -148,15 +145,19 @@ function LogsTable({ logs, setPage }: LogsTableProps) { ref={observerRef} className="flex flex-col items-start h-[51vh] overflow-y-auto bg-transparent flex-grow gap-px" > - {logs.map((log, index) => { - if (index === logs.length - 1) { - return ( -
- -
- ); - } else return ; - })} + {loading ? ( + + ) : ( + logs.map((log, index) => { + if (index === logs.length - 1) { + return ( +
+ +
+ ); + } else return ; + }) + )}
);