import { Link } from "@tanstack/react-router"; import { usePollWhile } from "~/hooks/use-poll-while"; import { buttonClass } from "./ui/Button"; import { formatDuration } from "./ui/Primitives"; import type { RepoSummary } from "~/lib/types"; const POLL_INTERVAL_MS = 4000; type Props = { owner: string; name: string; status: RepoSummary["status"]; error: string | null; createdAt: number; canAdmin: boolean; }; /** * Artifacts reports no byte-level progress for imports or forks, so this shows an indeterminate bar * with elapsed time and refreshes until the provisioning Workflow marks the repo ready or failed. */ export function RepoProvisioning({ owner, name, status, error, createdAt, canAdmin }: Props) { const pending = status === "importing" || status === "forking"; const now = usePollWhile(pending, POLL_INTERVAL_MS); if (!pending) { return (
{error ? `Artifacts reported: ${error}.` : "Artifacts did not finish copying the repository."}
{canAdmin && ( Delete and try again )}Cloudflare Artifacts is copying objects. You can leave this page — the{" "} {status === "importing" ? "import" : "fork"} keeps running and the repository opens here once it's ready.