{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "zeno-progress-upload-demo",
  "type": "registry:block",
  "title": "Zeno Progress: Upload List",
  "description": "Loading Progress Bar example, Upload List: Three files, each with its own bar, finishing at different times. The video's virus scan takes much longer, so you can watch its ruler go many decimals deep while the others are done. A take on the progress bar (loading bar). Fits features and app UI sections.",
  "author": "KeyframeUI <https://keyframeui.com>",
  "categories": [
    "features",
    "app-ui",
    "progress-bar",
    "preloader",
    "ai-thinking-state",
    "progress",
    "loading",
    "ai",
    "canvas"
  ],
  "docs": "Live preview, examples and props: https://keyframeui.com/components/zeno-progress#zeno-progress-upload-demo",
  "registryDependencies": [
    "https://keyframeui.com/r/zeno-progress.json"
  ],
  "files": [
    {
      "path": "components/zeno-progress-upload-demo.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { useInView } from \"motion/react\";\n\nimport { cn } from \"@/lib/utils\";\nimport { ZenoProgress } from \"@/components/ui/zeno-progress\";\n\nconst files = [\n  { name: \"brand-guidelines.pdf\", size: \"4.2 MB\", kind: \"PDF\", ms: 2600, interval: 600 },\n  { name: \"hero-loop.mp4\", size: \"86.1 MB\", kind: \"MP4\", ms: 21000, interval: 900 },\n  { name: \"Q3-review.key\", size: \"18.9 MB\", kind: \"KEY\", ms: 6400, interval: 750 },\n];\n\nexport function ZenoProgressUploadDemo() {\n  const ref = React.useRef<HTMLDivElement>(null);\n  const inView = useInView(ref, { once: true, amount: 0.4 });\n  const [batch, setBatch] = React.useState(0);\n  const [finished, setFinished] = React.useState<string[]>([]);\n\n  // Each file's server answers on its own schedule; the video takes far longer.\n  React.useEffect(() => {\n    if (!inView) return;\n    const timers = files.map((file) =>\n      window.setTimeout(() => setFinished((names) => [...names, file.name]), file.ms),\n    );\n    return () => timers.forEach((timer) => window.clearTimeout(timer));\n  }, [inView, batch]);\n\n  const allDone = finished.length === files.length;\n\n  const again = () => {\n    setFinished([]);\n    setBatch((b) => b + 1);\n  };\n\n  return (\n    <div\n      ref={ref}\n      className=\"w-full max-w-md rounded-2xl border border-zinc-200 bg-white p-2 shadow-sm dark:border-zinc-800 dark:bg-zinc-950\"\n    >\n      <div className=\"flex items-center justify-between px-3 pt-2 pb-3\">\n        <div>\n          <p className=\"text-sm font-medium text-zinc-900 dark:text-zinc-100\">Uploads</p>\n          <p className=\"text-xs text-zinc-500 dark:text-zinc-400\">\n            {finished.length} of {files.length} ready\n          </p>\n        </div>\n        <button\n          type=\"button\"\n          onClick={again}\n          disabled={!allDone}\n          className=\"rounded-full border border-zinc-200 px-3 py-1 text-xs font-medium text-zinc-700 transition-[opacity,transform] hover:bg-zinc-50 active:scale-[0.97] disabled:opacity-40 dark:border-zinc-800 dark:text-zinc-300 dark:hover:bg-zinc-900\"\n        >\n          Upload again\n        </button>\n      </div>\n\n      <ul className=\"space-y-1\">\n        {files.map((file) => {\n          const done = finished.includes(file.name);\n          return (\n            <li\n              key={file.name}\n              className=\"flex items-center gap-3 rounded-xl bg-zinc-50 px-3 py-3 dark:bg-zinc-900/60\"\n            >\n              <span\n                aria-hidden\n                className={cn(\n                  \"grid size-9 shrink-0 place-items-center rounded-lg border text-[10px] font-semibold tracking-wide transition-colors duration-300\",\n                  done\n                    ? \"border-zinc-900 bg-zinc-900 text-white dark:border-zinc-100 dark:bg-zinc-100 dark:text-zinc-900\"\n                    : \"border-zinc-200 bg-white text-zinc-500 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-400\",\n                )}\n              >\n                {file.kind}\n              </span>\n              <div className=\"min-w-0 flex-1\">\n                <div className=\"mb-1 flex items-baseline justify-between gap-3\">\n                  <p className=\"truncate text-sm font-medium text-zinc-900 dark:text-zinc-100\">{file.name}</p>\n                  <p className=\"shrink-0 text-xs text-zinc-400 dark:text-zinc-500\">{file.size}</p>\n                </div>\n                <ZenoProgress\n                  key={`${batch}-${inView}`}\n                  done={done}\n                  steps={[\"Uploading\", \"Scanning for viruses\"]}\n                  doneLabel=\"Uploaded\"\n                  interval={file.interval}\n                  className=\"text-xs text-zinc-500 dark:text-zinc-400\"\n                />\n              </div>\n            </li>\n          );\n        })}\n      </ul>\n    </div>\n  );\n}\n"
    }
  ]
}