{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "diff-apply-copy-demo",
  "type": "registry:block",
  "title": "Diff Apply: Release Note Edit",
  "description": "Animated Code Diff example, Release Note Edit: Not only code: a writing assistant tightens a Markdown release note, with `wrap` on and no line numbers. The reply under it follows `onComplete` and `onReview`. A take on the code diff (code review). Fits features and changelog sections.",
  "author": "KeyframeUI <https://keyframeui.com>",
  "categories": [
    "features",
    "changelog",
    "code-diff",
    "code-block",
    "code",
    "developer",
    "ai"
  ],
  "docs": "Live preview, examples and props: https://keyframeui.com/components/diff-apply#diff-apply-copy-demo",
  "registryDependencies": [
    "https://keyframeui.com/r/diff-apply.json"
  ],
  "files": [
    {
      "path": "components/diff-apply-copy-demo.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { DiffApply, type DiffApplyDecision } from \"@/components/ui/diff-apply\";\n\nconst before = `\n## Tinta 2.4\n\nWe are really excited to announce that Tinta 2.4 is finally here and available for everyone to use today!\n\n### What's new\n\n- Exports are now a lot faster than they used to be.\n- Fixed a bug where some people could sometimes not sign in.\n- Dark mode.\n\nThanks to everyone who sent us feedback!\n`;\n\nconst after = `\n## Tinta 2.4\n\nTinta 2.4 is out today.\n\n### What's new\n\n- PDF exports finish up to 3× faster.\n- Fixed sign-in failing for accounts created with Google.\n- Dark mode now follows your system setting.\n\nThanks to the 412 people who sent feedback during the beta.\n`;\n\nexport function DiffApplyCopyDemo() {\n  const [done, setDone] = React.useState(false);\n  const [decisions, setDecisions] = React.useState<DiffApplyDecision[]>([]);\n  const kept = decisions.filter((d) => d === \"kept\").length;\n  const undone = decisions.filter((d) => d === \"undone\").length;\n  const reviewed = decisions.length > 0 && decisions.every((d) => d !== \"pending\");\n\n  return (\n    <div className=\"flex w-full max-w-xl flex-col gap-3\">\n      <div className=\"ml-auto max-w-[85%] rounded-2xl rounded-br-md bg-zinc-900 px-3.5 py-2 text-[14px] leading-snug text-white dark:bg-zinc-100 dark:text-zinc-900\">\n        Tighten this for the changelog. Be specific.\n      </div>\n      <DiffApply\n        filename=\"release-notes.md\"\n        before={before}\n        after={after}\n        wrap\n        lineNumbers={false}\n        onComplete={() => setDone(true)}\n        onReview={setDecisions}\n      />\n      <p\n        aria-live=\"polite\"\n        className=\"min-h-5 px-1 text-[13px] text-zinc-500 transition-opacity duration-300 dark:text-zinc-400\"\n        style={{ opacity: done ? 1 : 0 }}\n      >\n        {reviewed\n          ? kept === decisions.length\n            ? \"All three edits kept. Ready to publish.\"\n            : `${kept} kept, ${undone} undone.`\n          : \"Cut 12 words and named the numbers. Keep what reads right.\"}\n      </p>\n    </div>\n  );\n}\n"
    }
  ]
}