{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "danger-zone-01",
  "title": "Danger Zone",
  "description": "A project settings danger zone: pause deployments with an undo window, transfer the project in a dialog that shows what changes, and delete it in a dialog that asks for the project name.",
  "registryDependencies": [
    "@sureui/confirm-button",
    "@sureui/confirm-dialog",
    "@sureui/consequences",
    "button",
    "card"
  ],
  "files": [
    {
      "path": "components/blocks/danger-zone-01/danger-zone.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n  Card,\n  CardContent,\n  CardDescription,\n  CardHeader,\n  CardTitle,\n} from \"@/components/ui/card\"\nimport { ConfirmButton } from \"@/components/ui/sureui/confirm-button\"\nimport { ConfirmDialog } from \"@/components/ui/sureui/confirm-dialog\"\nimport { Consequences } from \"@/components/ui/sureui/consequences\"\n\ntype DangerZoneProps = {\n  project?: string\n  team?: string\n  transferTo?: string\n  className?: string\n}\n\nfunction request() {\n  return Promise.resolve()\n}\n\nfunction DangerZone({\n  project = \"acme-prod\",\n  team = \"Acme\",\n  transferTo = \"Design\",\n  className,\n}: DangerZoneProps) {\n  const [paused, setPaused] = React.useState(false)\n  const [resuming, setResuming] = React.useState(false)\n  const [owner, setOwner] = React.useState(team)\n  const [deleted, setDeleted] = React.useState(false)\n  const transferred = owner !== team\n\n  if (deleted) {\n    return (\n      <Card role=\"status\" className={cn(\"w-full\", className)}>\n        <CardHeader>\n          <CardTitle>{project} was deleted</CardTitle>\n          <CardDescription>\n            Its deployments, domains and data are gone.\n          </CardDescription>\n        </CardHeader>\n      </Card>\n    )\n  }\n\n  const rows = [\n    {\n      title: \"Pause deployments\",\n      description: paused\n        ? \"Paused. New pushes wait until you resume.\"\n        : \"Stop deploying new pushes.\",\n      action: paused ? (\n        <Button\n          variant=\"outline\"\n          size=\"sm\"\n          disabled={resuming}\n          onClick={async () => {\n            setResuming(true)\n            await request()\n            setPaused(false)\n            setResuming(false)\n          }}\n        >\n          Resume\n        </Button>\n      ) : (\n        <ConfirmButton\n          undo\n          variant=\"outline\"\n          size=\"sm\"\n          onConfirm={async () => {\n            await request()\n            setPaused(true)\n          }}\n        >\n          Pause\n        </ConfirmButton>\n      ),\n    },\n    {\n      title: \"Transfer project\",\n      description: transferred\n        ? `Transferred to ${owner}.`\n        : `Move ${project} to ${transferTo}.`,\n      action: transferred ? null : (\n        <ConfirmDialog\n          title={`Transfer ${project} to ${transferTo}?`}\n          description={`${transferTo} gets the project, its deployments and domains.`}\n          consequences={\n            <Consequences\n              title=\"What changes\"\n              items={[\n                { label: \"Owner\", from: team, to: transferTo },\n                { label: `${team} members`, to: \"No access\" },\n              ]}\n            />\n          }\n          confirmLabel=\"Transfer\"\n          onConfirm={async () => {\n            await request()\n            setOwner(transferTo)\n          }}\n        >\n          <Button variant=\"outline\" size=\"sm\">\n            Transfer\n          </Button>\n        </ConfirmDialog>\n      ),\n    },\n    {\n      title: \"Delete project\",\n      description: \"Remove its deployments, domains and data.\",\n      action: (\n        <ConfirmDialog\n          title={`Delete ${project}?`}\n          description=\"This removes the project, its deployments, domains and data. It can't be undone.\"\n          phrase={project}\n          acknowledgements={[\"Active deployments will go offline.\"]}\n          confirmLabel=\"Delete project\"\n          variant=\"destructive\"\n          onConfirm={async () => {\n            await request()\n            setDeleted(true)\n          }}\n        >\n          <Button variant=\"destructive\" size=\"sm\">\n            Delete\n          </Button>\n        </ConfirmDialog>\n      ),\n    },\n  ]\n\n  return (\n    <Card className={cn(\"@container/danger w-full\", className)}>\n      <CardHeader>\n        <CardTitle>Danger zone</CardTitle>\n      </CardHeader>\n      <CardContent className=\"divide-y\">\n        {rows.map((row) => (\n          <div\n            key={row.title}\n            className=\"flex flex-col items-start gap-3 py-4 first:pt-0 last:pb-0 @sm/danger:flex-row @sm/danger:items-center @sm/danger:justify-between @sm/danger:gap-4\"\n          >\n            <div className=\"grid min-w-0 gap-1\">\n              <p className=\"font-medium\">{row.title}</p>\n              <p className=\"break-words text-muted-foreground\">\n                {row.description}\n              </p>\n            </div>\n            {row.action}\n          </div>\n        ))}\n      </CardContent>\n    </Card>\n  )\n}\n\nexport { DangerZone, type DangerZoneProps }\n",
      "type": "registry:component",
      "target": "@components/danger-zone.tsx"
    }
  ],
  "categories": [
    "block",
    "settings"
  ],
  "type": "registry:block"
}