{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "nautilus-queue-demo",
  "type": "registry:block",
  "title": "Nautilus: Up Next",
  "description": "Spiral Image Carousel example, Up Next: A listening queue. A take on the spiral gallery (spiral carousel). Fits portfolio, hero and shop sections.",
  "author": "KeyframeUI <https://keyframeui.com>",
  "categories": [
    "portfolio",
    "hero",
    "shop",
    "spiral-gallery",
    "carousel",
    "image-gallery",
    "gallery",
    "motion"
  ],
  "docs": "Live preview, examples and props: https://keyframeui.com/components/nautilus#nautilus-queue-demo",
  "registryDependencies": [
    "https://keyframeui.com/r/nautilus.json"
  ],
  "files": [
    {
      "path": "components/nautilus-queue-demo.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nimport { Nautilus } from \"@/components/ui/nautilus\";\n\nconst cover = (id: string) =>\n  `https://images.unsplash.com/photo-${id}?auto=format&fit=crop&w=800&h=800&q=80`;\n\n// Each track plays for a few seconds here; `length` is what the player shows.\nconst QUEUE = [\n  { src: cover(\"1626875953051-ba3d609252e9\"), alt: \"Cover of Sunday Blue by Marisol Eke: a sunflower on electric blue\", title: \"Sunday Blue\", artist: \"Marisol Eke\", length: \"3:41\" },\n  { src: cover(\"1661432432103-42999ae07367\"), alt: \"Cover of Backbeat by The Odd Hours: a drummer's silhouette on violet\", title: \"Backbeat\", artist: \"The Odd Hours\", length: \"4:02\" },\n  { src: cover(\"1550859492-d5da9d8e45f3\"), alt: \"Cover of Soft Focus by Toru Vale: a soft blue, orange and pink gradient\", title: \"Soft Focus\", artist: \"Toru Vale\", length: \"2:58\" },\n  { src: cover(\"1629276301820-0f3eedc29fd0\"), alt: \"Cover of Green Room Live by Haddo: a guitarist raised above the crowd in green haze\", title: \"Green Room Live\", artist: \"Haddo\", length: \"5:16\" },\n  { src: cover(\"1639835203652-99c8e298d13d\"), alt: \"Cover of Bloom Cycle by Ines Laraki: magenta flowers on teal\", title: \"Bloom Cycle\", artist: \"Ines Laraki\", length: \"3:27\" },\n  { src: cover(\"1545431613-51ec097943c6\"), alt: \"Cover of Light Leak by Ana Brightwell: a rainbow light leak on black\", title: \"Light Leak\", artist: \"Ana Brightwell\", length: \"4:44\" },\n  { src: cover(\"1618005182384-a83a8bd57fbe\"), alt: \"Cover of Tidal by Kofi Mensa: violet, pink and cyan waves\", title: \"Tidal\", artist: \"Kofi Mensa\", length: \"3:12\" },\n  { src: cover(\"1566127385722-1178df27105d\"), alt: \"Cover of Neon Heart by Lumi Sato: a pink neon heart on a dark wall\", title: \"Neon Heart\", artist: \"Lumi Sato\", length: \"3:55\" },\n  { src: cover(\"1602848596718-45693ff58c78\"), alt: \"Cover of Side B by Marisol Eke: a black record with a blank label\", title: \"Side B\", artist: \"Marisol Eke\", length: \"4:20\" },\n  { src: cover(\"1550275994-cdc89cd1948f\"), alt: \"Cover of Night Drive by The Odd Hours: red and blue light trails on black\", title: \"Night Drive\", artist: \"The Odd Hours\", length: \"3:36\" },\n];\n\nconst PLAY_FOR = 6000; // ms each track plays in the demo\n\nexport function NautilusQueueDemo() {\n  const [index, setIndex] = React.useState(0);\n  const [playing, setPlaying] = React.useState(true);\n  const barRef = React.useRef<HTMLDivElement>(null);\n  const runRef = React.useRef<Animation | null>(null);\n  const track = QUEUE[index];\n  const next = QUEUE[(index + 1) % QUEUE.length];\n\n  // The progress bar is the clock: when it fills, the queue moves up one.\n  React.useEffect(() => {\n    const bar = barRef.current;\n    if (!bar) return;\n    const run = bar.animate([{ transform: \"scaleX(0)\" }, { transform: \"scaleX(1)\" }], {\n      duration: PLAY_FOR,\n      easing: \"linear\",\n      fill: \"forwards\",\n    });\n    run.onfinish = () => setIndex((i) => (i + 1) % QUEUE.length);\n    runRef.current = run;\n    return () => run.cancel();\n  }, [index]);\n\n  React.useEffect(() => {\n    const run = runRef.current;\n    if (!run) return;\n    if (playing) run.play();\n    else run.pause();\n  }, [playing, index]);\n\n  return (\n    <div className=\"w-full max-w-3xl overflow-hidden rounded-3xl bg-zinc-100 text-zinc-950 ring-1 ring-zinc-950/5 dark:bg-zinc-900 dark:text-white dark:ring-white/10\">\n      <div className=\"flex items-center justify-between px-6 pt-5 text-xs\">\n        <p className=\"font-semibold tracking-[-0.01em]\">Driftwave</p>\n        <p className=\"text-zinc-600 dark:text-zinc-400\">Up next · {QUEUE.length} in the queue</p>\n      </div>\n\n      <Nautilus\n        items={QUEUE}\n        index={index}\n        onIndexChange={(i) => setIndex(i)}\n        autoplay={false}\n        aspect={1}\n        slots={13}\n        growth={1.22}\n        label=\"Listening queue\"\n        className=\"h-[20rem] sm:h-[24rem] [--nautilus-radius:0.75rem]\"\n      />\n\n      <div className=\"m-2 mt-0 rounded-2xl bg-white p-4 shadow-sm ring-1 ring-zinc-950/5 sm:p-5 dark:bg-zinc-950 dark:ring-white/10\">\n        <div className=\"flex items-center gap-4\">\n          <button\n            type=\"button\"\n            aria-label={playing ? \"Pause\" : \"Play\"}\n            onClick={() => setPlaying((p) => !p)}\n            className=\"grid size-11 shrink-0 place-items-center rounded-full bg-zinc-950 text-white transition-transform active:scale-95 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-zinc-950 dark:bg-white dark:text-zinc-950 dark:focus-visible:outline-white\"\n          >\n            {playing ? (\n              <svg viewBox=\"0 0 16 16\" className=\"size-4\" fill=\"currentColor\" aria-hidden>\n                <rect x=\"4\" y=\"3\" width=\"2.6\" height=\"10\" rx=\"0.8\" />\n                <rect x=\"9.4\" y=\"3\" width=\"2.6\" height=\"10\" rx=\"0.8\" />\n              </svg>\n            ) : (\n              <svg viewBox=\"0 0 16 16\" className=\"size-4 translate-x-px\" fill=\"currentColor\" aria-hidden>\n                <path d=\"M5 3.2v9.6a.5.5 0 0 0 .77.42l7.2-4.8a.5.5 0 0 0 0-.84l-7.2-4.8A.5.5 0 0 0 5 3.2Z\" />\n              </svg>\n            )}\n          </button>\n          <div className=\"min-w-0 flex-1\" aria-live=\"polite\">\n            <p className=\"truncate text-sm font-semibold tracking-[-0.01em]\">{track.title}</p>\n            <p className=\"truncate text-sm text-zinc-500 dark:text-zinc-400\">{track.artist}</p>\n          </div>\n          <button\n            type=\"button\"\n            onClick={() => setIndex((i) => (i + 1) % QUEUE.length)}\n            className=\"hidden min-w-0 items-center gap-2 rounded-full py-1.5 pr-1 pl-3 text-right text-xs text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-950 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-zinc-950 sm:flex dark:text-zinc-400 dark:hover:bg-zinc-900 dark:hover:text-white dark:focus-visible:outline-white\"\n          >\n            <span className=\"truncate\">\n              Next: <span className=\"text-zinc-950 dark:text-white\">{next.title}</span>\n            </span>\n            <svg viewBox=\"0 0 16 16\" className=\"size-4 shrink-0\" fill=\"currentColor\" aria-hidden>\n              <path d=\"M3 3.6v8.8a.5.5 0 0 0 .78.42L10 8.6V12a.5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5V4a.5.5 0 0 0-.5-.5h-1A.5.5 0 0 0 10 4v3.4L3.78 3.18A.5.5 0 0 0 3 3.6Z\" />\n            </svg>\n          </button>\n        </div>\n        <div className=\"mt-4 flex items-center gap-3 text-[11px] text-zinc-500 tabular-nums dark:text-zinc-400\">\n          <div className=\"h-1 flex-1 overflow-hidden rounded-full bg-zinc-200 dark:bg-zinc-800\">\n            <div ref={barRef} style={{ transform: \"scaleX(0)\" }} className=\"h-full origin-left rounded-full bg-[#00a3ff] dark:bg-[#38bdf8]\" />\n          </div>\n          <span>{track.length}</span>\n        </div>\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}