import { Progress } from "@/shadcn-bridge/heroui/progress"; export interface NodeUpgradeProgressState { stage: string; percent: number; message: string; } const STAGE_LABELS: Record = { downloading: "下载", verifying: "校验", installing: "安装 / 重启", }; export function NodeUpgradeProgress({ progress, }: { progress?: NodeUpgradeProgressState; }) { // The final installing event means the agent is restarting, not a durable // job state. Do not leave a stale "重启中 100%" banner after it reconnects. if ( !progress || (progress.stage === "installing" && progress.percent >= 100) ) { return null; } const percent = Number.isFinite(progress.percent) ? Math.min(100, Math.max(0, progress.percent)) : 0; const stage = STAGE_LABELS[progress.stage]; return (
); }