diff --git a/src/renderer/src/components/PlaywrightDownloadDialog.tsx b/src/renderer/src/components/PlaywrightDownloadDialog.tsx index a51ba1a..74179f1 100644 --- a/src/renderer/src/components/PlaywrightDownloadDialog.tsx +++ b/src/renderer/src/components/PlaywrightDownloadDialog.tsx @@ -36,8 +36,11 @@ export default function PlaywrightDownloadDialog({ }, []) // Format ETA to human-readable string - const formatETA = useCallback((seconds: number): string => { - if (seconds < 0 || !Number.isFinite(seconds)) return '计算中...' + const formatETA = useCallback((seconds: number | undefined): string => { + if (seconds === undefined || seconds < 0 || !Number.isFinite(seconds)) { + return '计算中...' + } + if (seconds === 0) return '已完成' if (seconds < 60) return `${Math.round(seconds)}秒` const mins = Math.floor(seconds / 60) const secs = Math.round(seconds % 60) @@ -169,19 +172,25 @@ export default function PlaywrightDownloadDialog({
总大小
- {progress ? formatBytes(progress.totalBytes) : '计算中...'} + {progress && progress.totalBytes > 0 + ? formatBytes(progress.totalBytes) + : '计算中...'}
速度
- {progress?.speed ? `${formatBytes(progress.speed)}/秒` : '计算中...'} + {progress && progress.speed >= 0 + ? `${formatBytes(progress.speed)}/秒` + : '计算中...'}
剩余时间
- {progress?.eta !== undefined ? formatETA(progress.eta) : '计算中...'} + {progress?.eta !== undefined && progress.eta >= 0 + ? formatETA(progress.eta) + : '计算中...'}