import type { JobStatus } from "../types"; interface ProgressIndicatorProps { progress: number; message: string; status: JobStatus; elapsedSeconds?: number; } /** * Visual progress indicator for long-running ML inference jobs. * * Shows: * - Progress bar with percentage * - Current operation message * - Elapsed time * - Status-appropriate coloring (blue for running, red for failed) */ export function ProgressIndicator({ progress, message, status, elapsedSeconds, }: ProgressIndicatorProps) { const isError = status === "failed"; const isComplete = status === "completed"; const isWakingUp = status === "waking_up"; // Determine bar color based on status const barColorClass = isError ? "bg-red-500" : isComplete ? "bg-green-500" : isWakingUp ? "bg-yellow-500" : "bg-blue-500"; // Animate the bar while running or waking up const animationClass = status === "running" || status === "pending" || status === "waking_up" ? "animate-pulse" : ""; return (
{/* Header with message and percentage */}
{message} {progress}%
{/* Progress bar */}
{/* Footer with elapsed time and status */}
{elapsedSeconds !== undefined ? ( Elapsed: {elapsedSeconds.toFixed(1)}s ) : ( Starting... )} {status === "waking_up" ? "waking up" : status}
); }