# Patch review actions

> Agent-proposed diff with accept and reject actions.

A shadcn/ui block from the [@reui](https://reui.io) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/reui/c-code-block-22).

- Page, with a live preview: https://shadcn.exchange/r/reui/c-code-block-22
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/reui/c-code-block-22-light-a5487ee0def49c82.png
- Registry item: https://reui.io/r/new-york-v4/c-code-block-22.json
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://reui.io/r/new-york-v4/c-code-block-22.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `@reui/badge`, `button`, `card`, `@reui/code-block`

## Files

### `c-code-block-22.tsx`

```tsx
"use client"

import { useState } from "react"
import { Badge } from "@/components/reui/badge"
import {
  CodeBlock,
  CodeBlockHeader,
  CodeBlockTitle,
} from "@/components/reui/code-block/code-block"

import { Button } from "@/components/ui/button"
import { Card, CardContent, CardFooter } from "@/components/ui/card"

const patch = `export async function retryPayment(orderId: string) {
  const order = await orders.find(orderId)
  await payments.charge(order)
  const receipt = await payments.charge(order, { idempotencyKey: orderId })
  await notify.customer(order, receipt)
  return receipt
}`

/*
 * `variant="ghost"` drops the block's own border and background so the Card
 * supplies the chrome exactly once; the zeroed Card padding is what lets the
 * ghost surface sit flush against the footer.
 */
export function Pattern() {
  const [decision, setDecision] = useState<"accepted" | "rejected" | null>(null)

  return (
    <Card className="w-full max-w-2xl gap-0 py-0">
      <CardContent className="p-0">
        <CodeBlock
          code={patch}
          language="typescript"
          showLineNumbers
          variant="ghost"
          diff={{ added: [4, 5, 6], removed: [3] }}
        >
          <CodeBlockHeader>
            <CodeBlockTitle>billing/retry-payment.ts</CodeBlockTitle>
            <div className="ml-auto flex items-center gap-1.5">
              <Badge variant="success-light">+3</Badge>
              <Badge variant="destructive-light">-1</Badge>
            </div>
          </CodeBlockHeader>
        </CodeBlock>
      </CardContent>

      <CardFooter className="border-border bg-muted/40 border-t px-3 py-2!">
        <span className="text-muted-foreground text-xs">
          {decision === null && "Agent proposed this change"}
          {decision === "accepted" && "Change applied to the branch"}
          {decision === "rejected" && "Change discarded"}
        </span>
        <div className="ml-auto flex items-center gap-1.5">
          {decision === null ? (
            <>
              <Button
                size="sm"
                variant="outline"
                onClick={() => setDecision("rejected")}
              >
                Reject
              </Button>
              <Button size="sm" onClick={() => setDecision("accepted")}>
                Accept
              </Button>
            </>
          ) : (
            <Button size="sm" variant="ghost" onClick={() => setDecision(null)}>
              Undo
            </Button>
          )}
        </div>
      </CardFooter>
    </Card>
  )
}
```
