{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "bot-template-showcase",
  "title": "Bot Template Showcase",
  "description": "A gallery of ready-made AI bots: search and filter by team, open one to see what it does and connects to, and add it to your workspace.",
  "dependencies": [],
  "files": [
    {
      "path": "registry/new-york/bot-template-showcase/bot-template-showcase.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface BotTemplate {\n  id: string;\n  name: string;\n  category: string;\n  summary: string;\n  /** Teams using it. */\n  uses: number;\n  /** Plain saving, e.g. \"6 hours a week\". */\n  saves: string;\n  tools: string[];\n  /** What it does, in order. */\n  steps: string[];\n}\n\nexport interface BotTemplateShowcaseProps extends Omit<\n  React.ComponentPropsWithoutRef<\"section\">,\n  \"title\"\n> {\n  theme?: \"dark\" | \"light\";\n  title?: string;\n  subtitle?: string;\n  templates?: BotTemplate[];\n  onUse?: (template: BotTemplate) => void;\n}\n\nconst FONT =\n  '\"Inter Variable\", Inter, \"SF Pro Display\", -apple-system, BlinkMacSystemFont, sans-serif';\nconst ACCENT = \"#5E6AD2\";\nconst GREEN = \"#27A644\";\nconst RING = \"outline-none focus-visible:ring-2 focus-visible:ring-[#5E6AD2]\";\nconst ALL = \"All\";\n\nconst PALETTES = {\n  dark: {\n    bg: \"#08090A\",\n    cell: \"#0B0C0D\",\n    hover: \"#101112\",\n    panel: \"#0F1011\",\n    tile: \"#161718\",\n    border: \"rgba(255,255,255,0.08)\",\n    scrim: \"rgba(8,9,10,0.6)\",\n    text: \"#F7F8F8\",\n    soft: \"#D0D6E0\",\n    sub: \"#8A8F98\",\n    faint: \"#62666D\",\n    chip: \"rgba(255,255,255,0.05)\",\n    btn: \"#E5E5E6\",\n    btnText: \"#08090A\",\n  },\n  light: {\n    bg: \"#FFFFFF\",\n    cell: \"#FFFFFF\",\n    hover: \"#F7F8F8\",\n    panel: \"#FFFFFF\",\n    tile: \"#F7F8F8\",\n    border: \"rgba(8,9,10,0.08)\",\n    scrim: \"rgba(255,255,255,0.6)\",\n    text: \"#08090A\",\n    soft: \"#3C3F44\",\n    sub: \"#62666D\",\n    faint: \"#8A8F98\",\n    chip: \"rgba(8,9,10,0.04)\",\n    btn: \"#08090A\",\n    btnText: \"#F7F8F8\",\n  },\n};\n\nconst DEFAULT_TEMPLATES: BotTemplate[] = [\n  {\n    id: \"triage\",\n    name: \"Ticket triage\",\n    category: \"Support\",\n    summary:\n      \"Reads new tickets, tags them and sends each one to the right team.\",\n    uses: 2140,\n    saves: \"9 hours a week\",\n    tools: [\"Helpdesk\", \"Slack\"],\n    steps: [\n      \"Read the new ticket\",\n      \"Pick a tag and priority\",\n      \"Assign it to a team\",\n      \"Post urgent ones to Slack\",\n    ],\n  },\n  {\n    id: \"refund\",\n    name: \"Refund drafts\",\n    category: \"Support\",\n    summary:\n      \"Checks the order and drafts a reply that follows your refund policy.\",\n    uses: 980,\n    saves: \"6 hours a week\",\n    tools: [\"Helpdesk\", \"Orders\"],\n    steps: [\n      \"Find the order\",\n      \"Check it against your policy\",\n      \"Draft a reply\",\n      \"Wait for your approval\",\n    ],\n  },\n  {\n    id: \"leads\",\n    name: \"Lead research\",\n    category: \"Sales\",\n    summary: \"Turns a new signup into a short brief before your first call.\",\n    uses: 1630,\n    saves: \"4 hours a week\",\n    tools: [\"CRM\", \"Web search\"],\n    steps: [\n      \"Read the signup\",\n      \"Research the company\",\n      \"Score the fit\",\n      \"Add a brief to the CRM\",\n    ],\n  },\n  {\n    id: \"followup\",\n    name: \"Deal follow-up\",\n    category: \"Sales\",\n    summary: \"Spots deals going quiet and drafts a nudge for the owner.\",\n    uses: 720,\n    saves: \"3 hours a week\",\n    tools: [\"CRM\", \"Email\"],\n    steps: [\n      \"Find quiet deals\",\n      \"Read the last emails\",\n      \"Draft a follow-up\",\n      \"Send it to the owner\",\n    ],\n  },\n  {\n    id: \"changelog\",\n    name: \"Changelog writer\",\n    category: \"Product\",\n    summary:\n      \"Turns merged pull requests into release notes people want to read.\",\n    uses: 1210,\n    saves: \"2 hours a week\",\n    tools: [\"GitHub\", \"Docs\"],\n    steps: [\n      \"Read merged changes\",\n      \"Group them by feature\",\n      \"Write the notes\",\n      \"Open a draft\",\n    ],\n  },\n  {\n    id: \"feedback\",\n    name: \"Feedback digest\",\n    category: \"Product\",\n    summary: \"Collects feedback from every channel into one weekly summary.\",\n    uses: 860,\n    saves: \"5 hours a week\",\n    tools: [\"Helpdesk\", \"Slack\", \"Docs\"],\n    steps: [\n      \"Gather this week's feedback\",\n      \"Group it by theme\",\n      \"Rank by volume\",\n      \"Post the digest\",\n    ],\n  },\n  {\n    id: \"invoices\",\n    name: \"Invoice matcher\",\n    category: \"Finance\",\n    summary:\n      \"Matches invoices to orders and flags anything that doesn't add up.\",\n    uses: 540,\n    saves: \"7 hours a week\",\n    tools: [\"Accounting\", \"Email\"],\n    steps: [\n      \"Read the invoice\",\n      \"Find the matching order\",\n      \"Flag differences\",\n      \"Queue it for payment\",\n    ],\n  },\n  {\n    id: \"spend\",\n    name: \"Spend watcher\",\n    category: \"Finance\",\n    summary: \"Warns you when a subscription or a team goes over budget.\",\n    uses: 410,\n    saves: \"2 hours a week\",\n    tools: [\"Accounting\", \"Slack\"],\n    steps: [\n      \"Check this week's spend\",\n      \"Compare it to budget\",\n      \"Find the cause\",\n      \"Send a short alert\",\n    ],\n  },\n  {\n    id: \"onboard\",\n    name: \"New hire setup\",\n    category: \"Operations\",\n    summary: \"Creates accounts and walks a new hire through their first week.\",\n    uses: 670,\n    saves: \"4 hours a week\",\n    tools: [\"Directory\", \"Slack\"],\n    steps: [\n      \"Create the accounts\",\n      \"Add them to teams\",\n      \"Send the welcome guide\",\n      \"Check in on day three\",\n    ],\n  },\n];\n\nexport function BotTemplateShowcase({\n  theme = \"dark\",\n  title = \"Start from a template\",\n  subtitle = \"Ready-made bots for the work your team repeats.\",\n  templates = DEFAULT_TEMPLATES,\n  onUse,\n  className,\n  style,\n  ...rest\n}: BotTemplateShowcaseProps) {\n  const c = PALETTES[theme];\n  const [category, setCategory] = React.useState(ALL);\n  const [query, setQuery] = React.useState(\"\");\n  const [open, setOpen] = React.useState<string | null>(null);\n  const [lastOpen, setLastOpen] = React.useState(templates[0]?.id ?? \"\");\n  const [added, setAdded] = React.useState<string[]>([]);\n  const closeRef = React.useRef<HTMLButtonElement>(null);\n\n  const categories = [ALL, ...new Set(templates.map((t) => t.category))];\n  const needle = query.trim().toLowerCase();\n  const matches = (t: BotTemplate, cat: string) =>\n    (cat === ALL || t.category === cat) &&\n    (!needle ||\n      `${t.name} ${t.summary} ${t.tools.join(\" \")}`\n        .toLowerCase()\n        .includes(needle));\n  const count = (cat: string) =>\n    templates.filter((t) => matches(t, cat)).length;\n  // Matches come first and the rest stay in the grid unseen, so filtering never changes the height.\n  const ordered = [\n    ...templates.filter((t) => matches(t, category)),\n    ...templates.filter((t) => !matches(t, category)),\n  ];\n  const shownCount = count(category);\n  const current = templates.find((t) => t.id === lastOpen);\n  const isOpen = open !== null;\n\n  React.useEffect(() => {\n    if (isOpen) closeRef.current?.focus();\n  }, [isOpen]);\n\n  const show = (id: string) => {\n    setLastOpen(id);\n    setOpen(id);\n  };\n\n  const use = () => {\n    if (!current) return;\n    setAdded((prev) =>\n      prev.includes(current.id) ? prev : [...prev, current.id],\n    );\n    onUse?.(current);\n  };\n\n  return (\n    <section\n      aria-label={title}\n      onKeyDown={(e) => {\n        if (e.key === \"Escape\") setOpen(null);\n      }}\n      className={`@container relative w-full overflow-hidden ${className ?? \"\"}`}\n      style={{ background: c.bg, color: c.text, fontFamily: FONT, ...style }}\n      {...rest}\n    >\n      <div inert={isOpen}>\n        <header className=\"px-5 pt-8 pb-5 @3xl:px-8\">\n          <div className=\"flex flex-wrap items-end justify-between gap-x-8 gap-y-4\">\n            <div className=\"min-w-0\">\n              <h2 className=\"m-0 text-[32px] leading-[38px] font-[510] tracking-[-0.022em]\">\n                {title}\n              </h2>\n              <p\n                className=\"m-0 mt-2 text-[14px] leading-[22px] tracking-[-0.011em]\"\n                style={{ color: c.sub }}\n              >\n                {subtitle}\n              </p>\n            </div>\n            <input\n              value={query}\n              onChange={(e) => setQuery(e.target.value)}\n              aria-label=\"Search templates\"\n              placeholder=\"Search templates\"\n              className=\"h-9 w-full rounded-full border bg-transparent px-3.5 text-[16px] tracking-[-0.011em] outline-none focus:border-[#5E6AD2] @3xl:w-[240px] @3xl:text-[13px]\"\n              style={{ borderColor: c.border, color: c.text }}\n            />\n          </div>\n          <div\n            role=\"group\"\n            aria-label=\"Category\"\n            className=\"mt-5 flex flex-wrap gap-1.5\"\n          >\n            {categories.map((cat) => {\n              const on = category === cat;\n              return (\n                <button\n                  key={cat}\n                  type=\"button\"\n                  data-category={cat}\n                  aria-pressed={on}\n                  onClick={() => setCategory(cat)}\n                  className={`flex h-7 cursor-pointer items-center gap-2 rounded-full border-0 px-3 text-[13px] leading-[20px] font-[510] tracking-[-0.011em] motion-safe:transition-colors motion-safe:duration-150 ${RING}`}\n                  style={{\n                    background: on ? c.chip : \"transparent\",\n                    color: on ? c.text : c.sub,\n                  }}\n                >\n                  {cat}\n                  <span className=\"tabular-nums\" style={{ color: c.sub }}>\n                    {count(cat)}\n                  </span>\n                </button>\n              );\n            })}\n          </div>\n        </header>\n\n        <div className=\"relative\">\n          <div\n            className=\"grid gap-px border-y @xl:grid-cols-2 @3xl:grid-cols-3\"\n            style={{ background: c.border, borderColor: c.border }}\n          >\n            {ordered.map((t, i) => {\n              const visible = i < shownCount;\n              const done = added.includes(t.id);\n              return (\n                <div\n                  key={t.id}\n                  className=\"min-w-0\"\n                  style={{ background: c.cell }}\n                >\n                  <button\n                    type=\"button\"\n                    data-template={t.id}\n                    tabIndex={visible ? 0 : -1}\n                    aria-hidden={!visible}\n                    onClick={() => show(t.id)}\n                    className={`flex size-full min-w-0 cursor-pointer flex-col border-0 p-5 text-left outline-none focus-visible:z-[1] focus-visible:ring-2 focus-visible:ring-[#5E6AD2] focus-visible:ring-inset motion-safe:transition-colors motion-safe:duration-150 @3xl:p-6 ${visible ? \"\" : \"invisible\"}`}\n                    style={{ background: c.cell }}\n                    onPointerEnter={(e) => {\n                      e.currentTarget.style.background = c.hover;\n                    }}\n                    onPointerLeave={(e) => {\n                      e.currentTarget.style.background = c.cell;\n                    }}\n                  >\n                    <span className=\"flex w-full items-center justify-between gap-3\">\n                      <span\n                        aria-hidden=\"true\"\n                        className=\"flex items-center justify-center rounded-lg text-[14px] leading-[20px] font-[590]\"\n                        style={{\n                          width: 34,\n                          height: 34,\n                          background: c.tile,\n                          color: ACCENT,\n                        }}\n                      >\n                        {t.name.slice(0, 1)}\n                      </span>\n                      <span\n                        className=\"text-[12px] leading-[16px] tracking-[-0.005em]\"\n                        style={{ color: done ? GREEN : c.faint }}\n                      >\n                        {done ? \"Added\" : t.category}\n                      </span>\n                    </span>\n                    <span\n                      className=\"mt-3 block text-[15px] leading-[22px] font-[510] tracking-[-0.012em]\"\n                      style={{ color: c.text }}\n                    >\n                      {t.name}\n                    </span>\n                    <span\n                      className=\"mt-1 block text-[13px] leading-[20px] tracking-[-0.011em]\"\n                      style={{ color: c.sub }}\n                    >\n                      {t.summary}\n                    </span>\n                    <span\n                      className=\"mt-auto block pt-3 text-[12px] leading-[16px] tracking-[-0.005em] tabular-nums\"\n                      style={{ color: c.faint }}\n                    >\n                      {t.uses.toLocaleString(\"en-US\")} teams, saves {t.saves}\n                    </span>\n                  </button>\n                </div>\n              );\n            })}\n          </div>\n          {shownCount === 0 && (\n            <p\n              className=\"absolute inset-x-0 top-16 m-0 text-center text-[13px] leading-[20px] tracking-[-0.011em]\"\n              style={{ color: c.sub }}\n            >\n              No templates match that.\n            </p>\n          )}\n        </div>\n      </div>\n\n      {/* The panel opens over the block, so it never pushes the grid around. */}\n      <div\n        aria-hidden=\"true\"\n        onClick={() => setOpen(null)}\n        className=\"absolute inset-0 motion-safe:transition-opacity motion-safe:duration-200\"\n        style={{\n          background: c.scrim,\n          opacity: isOpen ? 1 : 0,\n          pointerEvents: isOpen ? \"auto\" : \"none\",\n        }}\n      />\n      <aside\n        aria-label={current?.name}\n        aria-hidden={!isOpen}\n        inert={!isOpen}\n        className=\"absolute top-0 right-0 bottom-0 flex w-full flex-col border-l motion-safe:transition-transform motion-safe:duration-300 motion-safe:ease-[cubic-bezier(0.22,1,0.36,1)] @3xl:w-[400px]\"\n        style={{\n          background: c.panel,\n          borderColor: c.border,\n          transform: isOpen ? \"none\" : \"translateX(100%)\",\n        }}\n      >\n        {current && (\n          <>\n            <div className=\"flex items-center justify-between gap-3 p-5 pb-3\">\n              <span\n                className=\"text-[13px] leading-[20px] tracking-[-0.011em]\"\n                style={{ color: c.faint }}\n              >\n                {current.category}\n              </span>\n              <button\n                ref={closeRef}\n                type=\"button\"\n                data-close=\"\"\n                aria-label=\"Close\"\n                onClick={() => setOpen(null)}\n                className={`flex cursor-pointer items-center justify-center rounded-full border-0 ${RING}`}\n                style={{\n                  width: 30,\n                  height: 30,\n                  background: c.chip,\n                  color: c.sub,\n                }}\n              >\n                <svg\n                  aria-hidden=\"true\"\n                  viewBox=\"0 0 16 16\"\n                  width=\"14\"\n                  height=\"14\"\n                  fill=\"none\"\n                  className=\"block\"\n                >\n                  <path\n                    d=\"m4.5 4.5 7 7m0-7-7 7\"\n                    stroke=\"currentColor\"\n                    strokeWidth=\"1.5\"\n                    strokeLinecap=\"round\"\n                  />\n                </svg>\n              </button>\n            </div>\n            <div className=\"min-h-0 flex-1 overflow-y-auto px-5\">\n              <h3 className=\"m-0 text-[24px] leading-[30px] font-[590] tracking-[-0.018em]\">\n                {current.name}\n              </h3>\n              <p\n                className=\"m-0 mt-2 text-[14px] leading-[22px] tracking-[-0.011em]\"\n                style={{ color: c.soft }}\n              >\n                {current.summary}\n              </p>\n              <p\n                className=\"m-0 mt-5 text-[12px] leading-[16px] tracking-[-0.005em]\"\n                style={{ color: c.faint }}\n              >\n                What it does\n              </p>\n              <ol className=\"m-0 mt-2 list-none p-0\">\n                {current.steps.map((step, i) => (\n                  <li\n                    key={step}\n                    className=\"flex items-center gap-3 border-t py-2.5 text-[13.5px] leading-[20px] tracking-[-0.011em]\"\n                    style={{ borderColor: c.border, color: c.soft }}\n                  >\n                    <span\n                      className=\"shrink-0 text-[12px] leading-[16px] tabular-nums\"\n                      style={{ color: c.faint, width: 12 }}\n                    >\n                      {i + 1}\n                    </span>\n                    {step}\n                  </li>\n                ))}\n              </ol>\n              <p\n                className=\"m-0 mt-5 text-[12px] leading-[16px] tracking-[-0.005em]\"\n                style={{ color: c.faint }}\n              >\n                Connects to\n              </p>\n              <div className=\"mt-2 flex flex-wrap gap-1.5\">\n                {current.tools.map((tool) => (\n                  <span\n                    key={tool}\n                    className=\"flex h-7 items-center rounded-full px-3 text-[12.5px] leading-[18px] tracking-[-0.008em]\"\n                    style={{ background: c.chip, color: c.soft }}\n                  >\n                    {tool}\n                  </span>\n                ))}\n              </div>\n            </div>\n            <div className=\"p-5\">\n              <p\n                className=\"m-0 mb-3 text-[13px] leading-[20px] tracking-[-0.011em] tabular-nums\"\n                style={{ color: c.sub }}\n              >\n                Saves about {current.saves}\n              </p>\n              <button\n                type=\"button\"\n                data-use=\"\"\n                onClick={use}\n                disabled={added.includes(current.id)}\n                className={`h-10 w-full cursor-pointer rounded-full border-0 text-[13.5px] leading-[20px] font-[510] tracking-[-0.011em] disabled:cursor-default ${RING}`}\n                style={{\n                  background: added.includes(current.id) ? c.chip : c.btn,\n                  color: added.includes(current.id) ? GREEN : c.btnText,\n                }}\n              >\n                {added.includes(current.id)\n                  ? \"Added to workspace\"\n                  : \"Use this template\"}\n              </button>\n            </div>\n          </>\n        )}\n      </aside>\n    </section>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}