import type { Installation } from "../installation-metadata.ts"; const stages = [ ["preparing", "Preparing your account"], ["deploying", "Deploying Flarebot"], ["provisioning", "Provisioning your Sandbox"], ["verifying", "Verifying installation"], ] as const; export function InstallationProgress({ installation, updating = false, }: { installation: Pick | null; updating?: boolean; }) { const ready = installation?.status === "ready"; const failed = installation?.status === "failed"; const stage = ready ? stages.length : stages.findIndex(([value]) => value === installation?.progress); const completed = Math.max(0, stage) + 1; const total = stages.length + 1; const label = updating ? "Update progress" : "Installation progress"; const summary = ready ? updating ? "Update complete" : "Installation complete" : failed ? "Needs attention" : stage >= 0 ? stages[stage][1] : installation?.status === "reserved" ? "Ready to install" : updating ? "Preparing update…" : "Preparing installation…"; return (
{summary} {installation && ( {completed} of {total} steps complete )}
{installation && (
View {updating ? "update" : "installation"} steps
  1. Complete Cloudflare account connected
  2. {stages.map(([value, name], index) => (
  3. {index < stage ? "Complete" : index === stage ? failed ? "Stopped" : "In progress" : "Waiting"} {name}
  4. ))}
)}
); }