diff --git a/web/src/components/table/usage-logs/UsageLogsActions.jsx b/web/src/components/table/usage-logs/UsageLogsActions.jsx index a2e68fcd..728733d1 100644 --- a/web/src/components/table/usage-logs/UsageLogsActions.jsx +++ b/web/src/components/table/usage-logs/UsageLogsActions.jsx @@ -17,21 +17,51 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import React from 'react'; -import { Tag, Space, Spin } from '@douyinfe/semi-ui'; +import React, { useState, useEffect, useRef } from 'react'; +import { Tag, Space, Skeleton } from '@douyinfe/semi-ui'; import { renderQuota } from '../../../helpers'; import CompactModeToggle from '../../common/ui/CompactModeToggle'; const LogsActions = ({ stat, loadingStat, + showStat, compactMode, setCompactMode, t, }) => { + const [showSkeleton, setShowSkeleton] = useState(loadingStat); + const needSkeleton = !showStat || showSkeleton; + const loadingStartRef = useRef(Date.now()); + + useEffect(() => { + if (loadingStat) { + loadingStartRef.current = Date.now(); + setShowSkeleton(true); + } else { + const elapsed = Date.now() - loadingStartRef.current; + const remaining = Math.max(0, 500 - elapsed); + if (remaining === 0) { + setShowSkeleton(false); + } else { + const timer = setTimeout(() => setShowSkeleton(false), remaining); + return () => clearTimeout(timer); + } + } + }, [loadingStat]); + + // Skeleton placeholder layout (three tag-size blocks) + const placeholder = ( + + + + + + ); + return ( - -
+
+ + - -
- + +
); };