From b3e37e2f7c391390fba0e48634e7415d5de393b8 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Sun, 17 May 2026 16:31:30 +0800 Subject: [PATCH] feat(ui): add indeterminate mode to Progress MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Desktop's core-download dialog needs to show progress while the server returns no Content-Length (some mirrors omit it; the SnowLuma core release artifact does have it but GitHub's CDN sometimes strips it on redirects). Hard-coded 50% was a placeholder. Add an `indeterminate` boolean prop: when true, render a marquee bar that animates left-to-right indefinitely. When false, render the familiar bytes-done / bytes-total fill at `value%`. Hooked up via a new `@keyframes progress-marquee` in theme.css. Also dropped the bar's CSS transition from 500ms → 200ms so live download updates feel responsive instead of laggy. --- packages/ui/src/components/progress.tsx | 38 +++++++++++++++++++------ packages/ui/src/styles/theme.css | 9 ++++++ 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/packages/ui/src/components/progress.tsx b/packages/ui/src/components/progress.tsx index 0cc75e45..446ab746 100644 --- a/packages/ui/src/components/progress.tsx +++ b/packages/ui/src/components/progress.tsx @@ -4,28 +4,50 @@ import { cn } from '../lib/cn'; interface ProgressProps extends React.HTMLAttributes { value?: number; indicatorClassName?: string; + /** + * When true, the bar shows an animated marquee instead of a fixed + * width — useful when we know a job is running but don't yet know + * the total size (e.g. a download whose Content-Length is unknown). + */ + indeterminate?: boolean; } const Progress = React.forwardRef( - ({ className, value = 0, indicatorClassName, ...props }, ref) => { + ({ className, value = 0, indicatorClassName, indeterminate = false, ...props }, ref) => { const clamped = Math.max(0, Math.min(100, value)); return (
-
+ {indeterminate ? ( +
+ ) : ( +
+ )}
); - } + }, ); Progress.displayName = 'Progress'; diff --git a/packages/ui/src/styles/theme.css b/packages/ui/src/styles/theme.css index 23dd490a..1e02b17f 100644 --- a/packages/ui/src/styles/theme.css +++ b/packages/ui/src/styles/theme.css @@ -247,3 +247,12 @@ -webkit-backdrop-filter: saturate(180%) blur(12px); } } + +@keyframes progress-marquee { + 0% { + transform: translateX(-100%); + } + 100% { + transform: translateX(400%); + } +}