{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "first-project",
  "type": "registry:block",
  "title": "First Project",
  "description": "The empty Projects page of an app: one line on what projects are for, a Create button with its shortcut, a guide link and three templates. Creating one flies the icon into the first row of a real project list.",
  "categories": [
    "block",
    "Empty & Error"
  ],
  "dependencies": [
    "lucide-react",
    "motion"
  ],
  "registryDependencies": [
    "utils",
    "https://coss.com/ui/r/button.json",
    "https://coss.com/ui/r/kbd.json"
  ],
  "files": [
    {
      "path": "registry/devl/first-project.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport {\n  ArrowRightIcon,\n  BookOpenIcon,\n  BugIcon,\n  FolderKanbanIcon,\n  InboxIcon,\n  LayersIcon,\n  type LucideIcon,\n  MapIcon,\n  PlusIcon,\n  RocketIcon,\n  SearchIcon,\n  SquareCheckIcon,\n  UsersIcon,\n} from \"lucide-react\";\nimport { AnimatePresence, LayoutGroup, motion, useReducedMotion } from \"motion/react\";\nimport { type KeyboardEvent, useId, useState } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { Kbd } from \"@/components/ui/kbd\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface ProjectTemplate {\n  id: string;\n  name: string;\n  description: string;\n  icon: LucideIcon;\n  issues: number;\n  tone: \"violet\" | \"amber\" | \"sky\" | \"emerald\" | \"rose\";\n}\n\nexport interface ProjectRow {\n  id: string;\n  name: string;\n  issues: number;\n  icon: LucideIcon;\n  tone?: ProjectTemplate[\"tone\"];\n  templateId?: string;\n}\n\nexport interface FirstProjectProps {\n  workspace?: string;\n  user?: { name: string; initials: string };\n  templates?: ProjectTemplate[];\n  shortcut?: string;\n  defaultProjects?: ProjectRow[];\n  onCreate?: (template?: ProjectTemplate) => void;\n  onOpenGuide?: () => void;\n  className?: string;\n}\n\nconst defaultTemplates: ProjectTemplate[] = [\n  {\n    id: \"launch\",\n    name: \"Product launch\",\n    description: \"Milestones from beta to GA, with a launch-day checklist.\",\n    icon: RocketIcon,\n    issues: 14,\n    tone: \"violet\",\n  },\n  {\n    id: \"bugbash\",\n    name: \"Bug bash\",\n    description: \"A one-week sweep with triage, owners and a fix-by date.\",\n    icon: BugIcon,\n    issues: 8,\n    tone: \"amber\",\n  },\n  {\n    id: \"roadmap\",\n    name: \"Quarterly roadmap\",\n    description: \"Themes, bets and the issues that move each one forward.\",\n    icon: MapIcon,\n    issues: 6,\n    tone: \"sky\",\n  },\n];\n\nconst tones: Record<ProjectTemplate[\"tone\"], string> = {\n  violet: \"bg-violet-500/12 text-violet-700 dark:text-violet-300\",\n  amber: \"bg-amber-500/14 text-amber-700 dark:text-amber-300\",\n  sky: \"bg-sky-500/12 text-sky-700 dark:text-sky-300\",\n  emerald: \"bg-emerald-500/12 text-emerald-700 dark:text-emerald-300\",\n  rose: \"bg-rose-500/12 text-rose-700 dark:text-rose-300\",\n};\n\nconst nav: { label: string; icon: LucideIcon; active?: boolean }[] = [\n  { label: \"Inbox\", icon: InboxIcon },\n  { label: \"My issues\", icon: SquareCheckIcon },\n  { label: \"Projects\", icon: FolderKanbanIcon, active: true },\n  { label: \"Views\", icon: LayersIcon },\n  { label: \"Members\", icon: UsersIcon },\n];\n\nconst ease = [0.23, 1, 0.32, 1] as const;\nconst spring = { type: \"spring\", stiffness: 380, damping: 34, mass: 0.9 } as const;\n\nfunction Mark({ className }: { className?: string }) {\n  return (\n    <span className={cn(\"flex size-6 shrink-0 items-center justify-center rounded-md bg-primary text-primary-foreground\", className)}>\n      <svg aria-hidden className=\"size-4\" fill=\"none\" viewBox=\"0 0 28 28\">\n        <path d=\"M7 18.5 12 12l3.5 4.5 2-2.5 3.5 4.5\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2.6\" />\n      </svg>\n    </span>\n  );\n}\n\nfunction Count({ value }: { value: number }) {\n  const reduce = useReducedMotion();\n  return (\n    <span className=\"relative inline-flex h-5 min-w-5 items-center justify-center overflow-hidden rounded-full bg-muted px-1.5 font-medium text-muted-foreground text-xs tabular-nums\">\n      <AnimatePresence initial={false} mode=\"popLayout\">\n        <motion.span\n          animate={{ y: 0, opacity: 1 }}\n          exit={reduce ? { opacity: 0 } : { y: \"-100%\", opacity: 0 }}\n          initial={reduce ? { opacity: 0 } : { y: \"100%\", opacity: 0 }}\n          key={value}\n          transition={{ duration: 0.24, ease }}\n        >\n          {value}\n        </motion.span>\n      </AnimatePresence>\n    </span>\n  );\n}\n\nfunction ProgressRing({ value }: { value: number }) {\n  const r = 6;\n  const c = 2 * Math.PI * r;\n  return (\n    <svg aria-hidden className=\"size-4 -rotate-90\" viewBox=\"0 0 16 16\">\n      <circle className=\"stroke-border\" cx=\"8\" cy=\"8\" fill=\"none\" r={r} strokeWidth=\"2\" />\n      <circle className=\"stroke-primary\" cx=\"8\" cy=\"8\" fill=\"none\" r={r} strokeDasharray={c} strokeDashoffset={c * (1 - value)} strokeLinecap=\"round\" strokeWidth=\"2\" />\n    </svg>\n  );\n}\n\nexport function FirstProject({\n  workspace = \"Ridgeline\",\n  user = { name: \"Ada Lindqvist\", initials: \"AL\" },\n  templates = defaultTemplates,\n  shortcut = \"C\",\n  defaultProjects = [],\n  onCreate,\n  onOpenGuide,\n  className,\n}: FirstProjectProps) {\n  const reduce = useReducedMotion();\n  const uid = useId();\n  const [projects, setProjects] = useState<ProjectRow[]>(defaultProjects);\n  const [editing, setEditing] = useState<string | null>(null);\n  const [fresh, setFresh] = useState<string | null>(null);\n  const empty = projects.length === 0;\n  const tileId = `${uid}-tile`;\n\n  const create = (template?: ProjectTemplate) => {\n    const id = `${template?.id ?? \"blank\"}-${projects.length + 1}`;\n    setProjects((list) => [\n      {\n        id,\n        name: template?.name ?? \"\",\n        issues: template?.issues ?? 0,\n        icon: template?.icon ?? FolderKanbanIcon,\n        tone: template?.tone,\n        templateId: empty ? template?.id : undefined,\n      },\n      ...list,\n    ]);\n    setEditing(template ? null : id);\n    setFresh(id);\n    onCreate?.(template);\n  };\n\n  const rename = (id: string, name: string) => {\n    setProjects((list) => list.map((p) => (p.id === id ? { ...p, name: name.trim() || \"Untitled project\" } : p)));\n    setEditing(null);\n  };\n\n  const onKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {\n    if (e.metaKey || e.ctrlKey || e.altKey || e.repeat) return;\n    if ((e.target as HTMLElement).closest(\"input, textarea, [contenteditable=true]\")) return;\n    if (e.key.toLowerCase() !== shortcut.toLowerCase()) return;\n    e.preventDefault();\n    create();\n  };\n\n  const layout = reduce ? { duration: 0 } : { type: \"spring\" as const, stiffness: 300, damping: 30 };\n\n  return (\n    <div\n      className={cn(\"flex h-150 w-full max-w-275 overflow-hidden rounded-2xl border bg-sidebar p-2 text-foreground shadow-xs/5 outline-none\", className)}\n      onKeyDown={onKeyDown}\n      tabIndex={-1}\n    >\n      <aside className=\"hidden w-52 shrink-0 flex-col gap-5 px-2 py-2 md:flex\">\n        <div className=\"flex items-center gap-2 px-1\">\n          <Mark />\n          <span className=\"truncate font-semibold text-sm\">{workspace}</span>\n        </div>\n        <nav aria-label=\"Workspace\" className=\"flex flex-col gap-0.5\">\n          {nav.map(({ label, icon: Icon, active }) => (\n            <span\n              aria-current={active ? \"page\" : undefined}\n              className={cn(\n                \"flex h-8 items-center gap-2.5 rounded-lg px-2 text-sm\",\n                active ? \"bg-sidebar-accent font-medium text-sidebar-accent-foreground\" : \"text-sidebar-foreground\",\n              )}\n              key={label}\n            >\n              <Icon aria-hidden className=\"size-4 opacity-80\" />\n              {label}\n            </span>\n          ))}\n        </nav>\n        <div className=\"mt-auto flex items-center gap-2 px-1\">\n          <span className=\"flex size-6 items-center justify-center rounded-full bg-violet-500/15 font-medium text-[0.625rem] text-violet-700 dark:text-violet-300\">\n            {user.initials}\n          </span>\n          <span className=\"truncate text-sidebar-foreground text-sm\">{user.name}</span>\n        </div>\n      </aside>\n\n      <section className=\"flex min-w-0 flex-1 flex-col overflow-hidden rounded-lg border bg-background\">\n        <header className=\"flex h-12 shrink-0 items-center gap-2 border-b px-3 sm:px-4\">\n          <Mark className=\"md:hidden\" />\n          <h1 className=\"font-semibold text-sm\">Projects</h1>\n          <Count value={projects.length} />\n          <div className=\"ms-auto flex items-center gap-1\">\n            <Button aria-label=\"Search projects\" size=\"icon-sm\" variant=\"ghost\">\n              <SearchIcon />\n            </Button>\n            <Button onClick={() => create()} size=\"sm\" variant=\"outline\">\n              <PlusIcon />\n              New project\n            </Button>\n          </div>\n        </header>\n\n        <LayoutGroup id={uid}>\n          <div className=\"relative grid min-h-0 flex-1 overflow-y-auto\">\n            <AnimatePresence initial={false}>\n              {empty ? (\n                <motion.div\n                  className=\"col-start-1 row-start-1 flex flex-col items-center justify-center px-4 py-10 text-center sm:px-6\"\n                  exit={reduce ? { opacity: 0 } : { opacity: 0, scale: 0.98, filter: \"blur(4px)\" }}\n                  key=\"empty\"\n                  transition={{ duration: 0.2, ease }}\n                >\n                  <motion.div\n                    className=\"flex size-10 items-center justify-center rounded-xl border bg-card shadow-xs/5\"\n                    layoutId={tileId}\n                    transition={layout}\n                  >\n                    <FolderKanbanIcon aria-hidden className=\"size-5\" />\n                  </motion.div>\n                  <h2 className=\"mt-4 text-balance font-semibold text-lg\">Plan your first project</h2>\n                  <p className=\"mt-1.5 max-w-104 text-pretty text-muted-foreground text-sm\">\n                    Projects group issues around one outcome, like a launch or a migration, so the team can see what is left and when it ships.\n                  </p>\n                  <div className=\"mt-5 flex flex-wrap items-center justify-center gap-2\">\n                    <Button className=\"active:scale-[0.97]\" onClick={() => create()}>\n                      <PlusIcon />\n                      Create project\n                      <Kbd className=\"-me-1 bg-primary-foreground/16 text-primary-foreground max-sm:hidden\">{shortcut.toUpperCase()}</Kbd>\n                    </Button>\n                    <Button className=\"active:scale-[0.97]\" onClick={onOpenGuide} variant=\"outline\">\n                      <BookOpenIcon />\n                      Read the guide\n                    </Button>\n                  </div>\n\n                  <div className=\"mt-10 w-full max-w-160\">\n                    <div className=\"flex items-center gap-3 text-muted-foreground text-xs\">\n                      <span className=\"h-px flex-1 bg-border\" />\n                      Or start from a template\n                      <span className=\"h-px flex-1 bg-border\" />\n                    </div>\n                    <div className=\"mt-3 grid gap-2 sm:grid-cols-3\">\n                      {templates.map((t) => (\n                        <button\n                          className=\"group flex items-center gap-2.5 rounded-xl sm:flex-col sm:items-stretch border bg-card p-3 text-left shadow-xs/5 outline-none transition-[background-color,scale] duration-150 focus-visible:ring-2 focus-visible:ring-ring active:scale-[0.98] [@media(hover:hover)]:hover:bg-accent/50\"\n                          key={t.id}\n                          onClick={() => create(t)}\n                          type=\"button\"\n                        >\n                          <span className=\"flex min-w-0 flex-1 items-center gap-2 sm:flex-none\">\n                            <motion.span\n                              className={cn(\"flex size-7 shrink-0 items-center justify-center rounded-lg\", tones[t.tone])}\n                              layoutId={`${uid}-tpl-${t.id}`}\n                              transition={layout}\n                            >\n                              <t.icon aria-hidden className=\"size-4\" />\n                            </motion.span>\n                            <span className=\"truncate font-medium text-sm\">{t.name}</span>\n                          </span>\n                          <span className=\"line-clamp-2 text-muted-foreground text-xs max-sm:hidden\">{t.description}</span>\n                          <span className=\"flex shrink-0 items-center justify-between gap-2 text-muted-foreground text-xs tabular-nums sm:mt-auto\">\n                            {t.issues} issues\n                            <ArrowRightIcon\n                              aria-hidden\n                              className=\"size-3.5 opacity-0 transition-[opacity,translate] duration-150 group-focus-visible:opacity-100 [@media(hover:hover)]:group-hover:translate-x-0.5 [@media(hover:hover)]:group-hover:opacity-100\"\n                            />\n                          </span>\n                        </button>\n                      ))}\n                    </div>\n                  </div>\n                </motion.div>\n              ) : (\n                <motion.div\n                  animate={{ opacity: 1 }}\n                  className=\"col-start-1 row-start-1 flex flex-col self-start\"\n                  initial={{ opacity: 0 }}\n                  key=\"list\"\n                  transition={{ duration: 0.2, ease }}\n                >\n                  <div className=\"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-4 border-b px-4 py-2 text-muted-foreground text-xs sm:grid-cols-[minmax(0,1fr)_6rem_6rem_5rem]\">\n                    <span>Name</span>\n                    <span className=\"hidden sm:block\">Lead</span>\n                    <span className=\"hidden sm:block\">Issues</span>\n                    <span>Progress</span>\n                  </div>\n                  <ul aria-label=\"Projects\">\n                    <AnimatePresence initial={false}>\n                      {projects.map((p, i) => {\n                        const fromTile = i === projects.length - 1;\n                        const id = p.templateId ? `${uid}-tpl-${p.templateId}` : fromTile ? tileId : undefined;\n                        return (\n                          <motion.li\n                            animate={{ opacity: 1, y: 0 }}\n                            className=\"relative grid grid-cols-[minmax(0,1fr)_auto] items-center gap-4 border-b px-4 py-2.5 sm:grid-cols-[minmax(0,1fr)_6rem_6rem_5rem]\"\n                            initial={reduce || id ? { opacity: id ? 1 : 0 } : { opacity: 0, y: -8 }}\n                            key={p.id}\n                            layout={reduce ? false : \"position\"}\n                            transition={spring}\n                          >\n                            {fresh === p.id && (\n                              <motion.span\n                                animate={{ opacity: 0 }}\n                                aria-hidden\n                                className=\"pointer-events-none absolute inset-0 bg-accent\"\n                                initial={{ opacity: 1 }}\n                                transition={{ duration: 1.2, delay: 0.25, ease: \"easeOut\" }}\n                              />\n                            )}\n                            <span className=\"relative flex min-w-0 items-center gap-2.5\">\n                              <motion.span\n                                className={cn(\n                                  \"flex size-7 shrink-0 items-center justify-center rounded-lg\",\n                                  p.tone ? tones[p.tone] : \"border bg-card shadow-xs/5\",\n                                )}\n                                layoutId={id}\n                                transition={layout}\n                              >\n                                <p.icon aria-hidden className=\"size-4\" />\n                              </motion.span>\n                              {editing === p.id ? (\n                                <input\n                                  aria-label=\"Project name\"\n                                  autoFocus\n                                  className=\"h-7 min-w-0 flex-1 rounded-md bg-transparent px-1.5 -mx-1.5 font-medium text-sm outline-none ring-ring/40 placeholder:text-muted-foreground/72 focus-visible:ring-2\"\n                                  onBlur={(e) => rename(p.id, e.currentTarget.value)}\n                                  onKeyDown={(e) => {\n                                    if (e.key === \"Enter\" || e.key === \"Escape\") e.currentTarget.blur();\n                                  }}\n                                  placeholder=\"Name your project\"\n                                />\n                              ) : (\n                                <span className=\"truncate font-medium text-sm\">{p.name || \"Untitled project\"}</span>\n                              )}\n                            </span>\n                            <span className=\"relative hidden items-center gap-2 text-sm sm:flex\">\n                              <span className=\"flex size-5 items-center justify-center rounded-full bg-violet-500/15 font-medium text-[0.5625rem] text-violet-700 dark:text-violet-300\">\n                                {user.initials}\n                              </span>\n                              <span className=\"truncate text-muted-foreground\">{user.name.split(\" \")[0]}</span>\n                            </span>\n                            <span className=\"relative hidden text-muted-foreground text-sm tabular-nums sm:block\">{p.issues}</span>\n                            <span className=\"relative flex items-center gap-1.5 text-muted-foreground text-sm tabular-nums\">\n                              <ProgressRing value={0} />\n                              0%\n                            </span>\n                          </motion.li>\n                        );\n                      })}\n                    </AnimatePresence>\n                  </ul>\n                  <AnimatePresence>\n                    {projects.length === 1 && (\n                      <motion.p\n                        animate={{ opacity: 1, y: 0 }}\n                        className=\"flex flex-wrap items-center gap-1.5 px-4 py-3 text-muted-foreground text-xs\"\n                        exit={{ opacity: 0 }}\n                        initial={{ opacity: 0, y: reduce ? 0 : 4 }}\n                        transition={{ duration: 0.24, delay: 0.3, ease }}\n                      >\n                        Next, add issues to it, or press <Kbd>{shortcut.toUpperCase()}</Kbd> for another project.\n                      </motion.p>\n                    )}\n                  </AnimatePresence>\n                </motion.div>\n              )}\n            </AnimatePresence>\n          </div>\n        </LayoutGroup>\n      </section>\n    </div>\n  );\n}\n"
    }
  ]
}