{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "admin-record-actions",
  "title": "Admin record actions",
  "description": "A button that runs an operation on the record.",
  "files": [
    {
      "path": "registry/admin-record-actions.tsx",
      "content": "import { useState } from \"react\";\nimport { type RecordActionsProps } from \"@aotter/mantle-admin/app\";\nimport { AdminUnavailableError, useOperation } from \"@aotter/mantle-admin/hooks\";\n\n/**\n * Surface: browser (the record page; never an MCP Procedure action form).\n * Slots: record.actions:<schema>\n * Server authorization still applies to reads and writes; replacing this component grants nothing.\n */\n\n/** A button that runs the declared operation `approve` on this record. Rename the operation and shape its input. */\nexport function AdminRecordActions({ entry }: RecordActionsProps<object>) {\n  const { run, pending } = useOperation(\"approve\");\n  const [message, setMessage] = useState<string>();\n  const press = () => {\n    if (!run) return;\n    setMessage(undefined);\n    run({ id: entry.id }).then(\n      () => setMessage(\"Done\"),\n      (error: unknown) => setMessage(error instanceof AdminUnavailableError ? \"Not available\" : \"Failed\"),\n    );\n  };\n  return (\n    <>\n      <button type=\"button\" className=\"rounded-md border px-3 py-1.5 text-sm font-medium disabled:opacity-50\" disabled={pending || !run} onClick={press}>\n        Approve\n      </button>\n      {/* an unavailable host transport disables the button; the server still authorizes each invocation */}\n      {!run ? <span className=\"text-sm text-muted-foreground\">Read-only here</span> : null}\n      {message ? <span role=\"status\" className=\"text-sm text-muted-foreground\">{message}</span> : null}\n    </>\n  );\n}\n",
      "type": "registry:component",
      "target": "~/src/admin/admin-record-actions.tsx"
    }
  ],
  "meta": {
    "surface": "browser",
    "slots": [
      "record.actions:<schema>"
    ]
  },
  "type": "registry:component"
}