{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "conversation-demo",
  "title": "Conversation Demo",
  "description": "A worked example of Conversation: The scroll container a thread lives in. It follows a streaming reply to the bottom, and stops the moment the reader scrolls up to read something older.",
  "registryDependencies": [
    "https://ui.tinkererslabs.com/r/conversation.json"
  ],
  "files": [
    {
      "path": "components/demos/conversation-demo.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { Conversation } from \"@/registry/default/conversation/conversation\"\nimport { Message } from \"@/registry/default/message/message\"\n\n/** Stands in for a real profile picture, and is deliberately not square. */\nconst portrait =\n  \"data:image/svg+xml;utf8,\" +\n  encodeURIComponent(\n    `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 120 72\">\n      <rect width=\"120\" height=\"72\" fill=\"#d8cfc4\"/>\n      <circle cx=\"60\" cy=\"30\" r=\"15\" fill=\"#8a7f72\"/>\n      <path d=\"M28 72c4-18 18-26 32-26s28 8 32 26z\" fill=\"#8a7f72\"/>\n    </svg>`\n  )\n\nconst turns = [\n  { id: 1, role: \"user\" as const, text: \"Why is the migration failing?\" },\n  {\n    id: 2,\n    role: \"assistant\" as const,\n    text: \"The unique index is created before the backfill runs, so rows still holding a null email collide.\",\n  },\n  { id: 3, role: \"user\" as const, text: \"Can you reorder it?\" },\n  {\n    id: 4,\n    role: \"assistant\" as const,\n    text: \"Yes. Moving the backfill above the index is enough, and the test suite passes after that.\",\n  },\n  { id: 5, role: \"user\" as const, text: \"What about existing rows?\" },\n  {\n    id: 6,\n    role: \"assistant\" as const,\n    text: \"They are covered by the same backfill, so nothing else needs to change.\",\n  },\n]\n\nexport function ConversationDemo() {\n  return (\n    <Conversation className=\"border-border bg-background h-72 w-full max-w-xl rounded-[var(--radius)] border px-3\">\n      {turns.map((turn) => (\n        <Message\n          key={turn.id}\n          role={turn.role}\n          avatar={\n            turn.role === \"user\" ? (\n              // eslint-disable-next-line @next/next/no-img-element\n              <img alt=\"\" src={portrait} />\n            ) : (\n              \"M\"\n            )\n          }\n        >\n          {turn.text}\n        </Message>\n      ))}\n    </Conversation>\n  )\n}\n",
      "type": "registry:example"
    }
  ],
  "type": "registry:example"
}