{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "media-13",
  "type": "registry:block",
  "description": "Course lesson player with a progress-tracking curriculum sidebar of collapsible modules.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "button",
    "progress"
  ],
  "files": [
    {
      "path": "registry/designali/blocks/media/media-13.tsx",
      "content": "\"use client\"\n\nimport { useState } from \"react\"\nimport {\n  CircleCheck as CheckCircle2,\n  ChevronDown,\n  Circle,\n  Lock,\n  CirclePlay as PlayCircle,\n} from \"@designali/icons\"\n\nimport { Button } from \"@workspace/ui/components/button\"\nimport { Progress } from \"@workspace/ui/components/progress\"\nimport { cn } from \"@workspace/ui/lib/utils\"\n\ntype Lesson = { title: string; length: string; locked?: boolean }\nconst modules: { title: string; lessons: Lesson[] }[] = [\n  {\n    title: \"Foundations\",\n    lessons: [\n      { title: \"Welcome and course map\", length: \"3:12\" },\n      { title: \"Installing Designali blocks\", length: \"8:40\" },\n      { title: \"Your first layout\", length: \"12:05\" },\n    ],\n  },\n  {\n    title: \"Typography systems\",\n    lessons: [\n      { title: \"Choosing a type scale\", length: \"9:18\" },\n      { title: \"Line length and rhythm\", length: \"7:52\" },\n      { title: \"Pairing typefaces\", length: \"11:30\" },\n    ],\n  },\n  {\n    title: \"Colour and contrast\",\n    lessons: [\n      {\n        title: \"Building a palette from one hue\",\n        length: \"10:44\",\n        locked: true,\n      },\n      {\n        title: \"Accessible contrast in practice\",\n        length: \"8:21\",\n        locked: true,\n      },\n    ],\n  },\n]\nconst flat = modules.flatMap((m, mi) =>\n  m.lessons.map((l, li) => ({ ...l, key: `${mi}-${li}`, module: m.title }))\n)\n\nexport default function Media13() {\n  const [current, setCurrent] = useState(\"1-0\")\n  const [done, setDone] = useState<string[]>([\"0-0\", \"0-1\", \"0-2\"])\n  const [open, setOpen] = useState<number[]>([0, 1])\n  const lesson = flat.find((l) => l.key === current)!\n  const idx = flat.findIndex((l) => l.key === current)\n  const next = flat[idx + 1]\n  const pct = Math.round((done.length / flat.length) * 100)\n\n  const complete = () => {\n    setDone((d) => (d.includes(current) ? d : [...d, current]))\n    if (next && !next.locked) setCurrent(next.key)\n  }\n\n  return (\n    <section className=\"w-full bg-background py-16\">\n      <div className=\"mx-auto grid max-w-7xl gap-6 px-6 lg:grid-cols-[1fr_360px]\">\n        <div className=\"min-w-0\">\n          <div className=\"relative flex aspect-video items-center justify-center overflow-hidden border border-border bg-muted\">\n            <img\n              src=\"/img/dashboard-1-light.jpg\"\n              alt={lesson.title}\n              className=\"absolute inset-0 size-full object-cover\"\n            />\n            <div className=\"absolute inset-0 bg-background/40\" />\n            <div className=\"relative text-center\">\n              <PlayCircle\n                className=\"mx-auto size-14 text-foreground/80\"\n                strokeWidth={1.25}\n              />\n              <p className=\"mt-3 text-xs text-foreground\">{lesson.length}</p>\n            </div>\n          </div>\n          <div className=\"mt-6 flex flex-wrap items-start justify-between gap-4\">\n            <div>\n              <p className=\"text-xs text-muted-foreground\">\n                {lesson.module} - Lesson {idx + 1} of {flat.length}\n              </p>\n              <h2 className=\"mt-1 text-2xl font-semibold tracking-tight\">\n                {lesson.title}\n              </h2>\n            </div>\n            <Button\n              onClick={complete}\n              disabled={done.includes(current) && (!next || !!next.locked)}\n            >\n              {done.includes(current) ? \"Next lesson\" : \"Mark complete\"}\n            </Button>\n          </div>\n          <p className=\"mt-4 max-w-2xl text-sm text-muted-foreground\">\n            In this lesson Ali Imam works through a real Designali landing page\n            and rebuilds its hierarchy using only type. Download the starter\n            file from the resources tab and follow along at your own pace.\n          </p>\n        </div>\n        <aside className=\"border border-border lg:self-start\">\n          <div className=\"border-b border-border p-4\">\n            <p className=\"text-sm font-medium\">\n              Designali: Layout for Developers\n            </p>\n            <div className=\"mt-3 flex items-center gap-3\">\n              <Progress value={pct} className=\"flex-1\" />\n              <span className=\"font-sans text-xs tabular-nums\">{pct}%</span>\n            </div>\n          </div>\n          {modules.map((m, mi) => {\n            const isOpen = open.includes(mi)\n            return (\n              <div\n                key={m.title}\n                className=\"border-b border-border last:border-b-0\"\n              >\n                <button\n                  type=\"button\"\n                  aria-expanded={isOpen}\n                  onClick={() =>\n                    setOpen((o) =>\n                      o.includes(mi) ? o.filter((x) => x !== mi) : [...o, mi]\n                    )\n                  }\n                  className=\"flex w-full items-center justify-between gap-3 px-4 py-3 text-left text-sm font-medium hover:bg-muted/50\"\n                >\n                  <span>\n                    <span className=\"mr-2 font-sans text-xs text-muted-foreground\">\n                      0{mi + 1}\n                    </span>\n                    {m.title}\n                  </span>\n                  <ChevronDown\n                    className={cn(\n                      \"size-4 transition-transform\",\n                      isOpen && \"rotate-180\"\n                    )}\n                  />\n                </button>\n                {isOpen && (\n                  <ul className=\"pb-2\">\n                    {m.lessons.map((l, li) => {\n                      const key = `${mi}-${li}`\n                      const Icon = l.locked\n                        ? Lock\n                        : done.includes(key)\n                          ? CheckCircle2\n                          : Circle\n                      return (\n                        <li key={key}>\n                          <button\n                            type=\"button\"\n                            disabled={l.locked}\n                            onClick={() => setCurrent(key)}\n                            className={cn(\n                              \"flex w-full items-center gap-3 px-4 py-2 text-left text-sm disabled:cursor-not-allowed disabled:opacity-50\",\n                              key === current\n                                ? \"bg-muted font-medium\"\n                                : \"hover:bg-muted/50\"\n                            )}\n                          >\n                            <Icon\n                              className={cn(\n                                \"size-4 shrink-0\",\n                                done.includes(key) && !l.locked\n                                  ? \"text-primary dark:text-primary\"\n                                  : \"text-muted-foreground\"\n                              )}\n                            />\n                            <span className=\"min-w-0 flex-1 truncate\">\n                              {l.title}\n                            </span>\n                            <span className=\"font-sans text-xs text-muted-foreground\">\n                              {l.length}\n                            </span>\n                          </button>\n                        </li>\n                      )\n                    })}\n                  </ul>\n                )}\n              </div>\n            )\n          })}\n        </aside>\n      </div>\n    </section>\n  )\n}\n",
      "type": "registry:component"
    }
  ],
  "meta": {
    "iframeHeight": "750px"
  },
  "categories": [
    "media"
  ]
}