{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "casework-review-notes",
  "title": "Review notes",
  "description": "Notes on a request for other reviewers or for the requester, read and written through the host's Casework routes.",
  "dependencies": [
    "@registrystack/app-runtime@~0.43.0-next.0"
  ],
  "registryDependencies": [
    "@registrystack/casework-content",
    "@registrystack/casework-shared",
    "@registrystack/field-renderers",
    "@registrystack/ui-button"
  ],
  "files": [
    {
      "path": "casework/review-notes.tsx",
      "content": "import { useState } from \"react\";\nimport type { ReviewNoteAudience } from \"@registrystack/app-runtime\";\nimport { useReviewNote } from \"@registrystack/app-runtime/react\";\nimport { Button } from \"@/components/ui/button\";\nimport { InputField } from \"@/blocks/fields/input-field\";\nimport { useCaseworkContent } from \"@/blocks/casework/casework-content\";\nimport { caseworkRefusalText, Notice, Unconfirmed } from \"@/blocks/casework/shared\";\n\n/**\n * A note on the request, for other reviewers or for the requester. Fetches\n * its own note command from the request id.\n */\nexport function NotesPanel({ requestId }: { requestId: string }) {\n  const c = useCaseworkContent();\n  const note = useReviewNote(requestId);\n  const [audience, setAudience] = useState<ReviewNoteAudience>(\"reviewers\");\n  const [text, setText] = useState(\"\");\n  const [error, setError] = useState(\"\");\n  const state = note.state;\n  async function add() {\n    if (!text.trim()) {\n      setError(c.noteEmpty);\n      return;\n    }\n    setError(\"\");\n    const next = await note.add(audience, text);\n    if (next.state === \"confirmed\") setText(\"\");\n  }\n  return (\n    <section className=\"review-notes\">\n      <h2>{c.notesHeading}</h2>\n      <fieldset disabled={note.locked}>\n        <div role=\"radiogroup\" aria-label={c.audienceLegend}>\n          {([\"reviewers\", \"requester\"] as const).map((value) => (\n            <label key={value} htmlFor={`review-audience-${value}`}>\n              <input\n                type=\"radio\"\n                id={`review-audience-${value}`}\n                name=\"review-audience\"\n                checked={audience === value}\n                onChange={() => setAudience(value)}\n              />{\" \"}\n              {value === \"reviewers\" ? c.audienceReviewers : c.audienceRequester}\n            </label>\n          ))}\n        </div>\n        <InputField\n          name=\"review-note\"\n          label={c.noteLabel}\n          value={text}\n          multiline\n          onChange={setText}\n          error={error}\n        />\n      </fieldset>\n      <div className=\"actions\">\n        <Button\n          variant=\"outline\"\n          disabled={note.locked}\n          onClick={() => void add()}\n        >\n          {c.addNote}\n        </Button>\n      </div>\n      {state.state === \"confirmed\" && (\n        <Notice tone=\"success\">{c.noteAdded}</Notice>\n      )}\n      {state.state === \"refused\" && (\n        <Notice tone=\"warning\">\n          {caseworkRefusalText(c, state.refusal, c.taskNotApplied)}\n        </Notice>\n      )}\n      <Unconfirmed\n        // A note has no read back; only resending it can settle it.\n        command={{\n          state,\n          retry: note.retry,\n          dismissUnknown: note.dismissUnknown,\n        }}\n        text={c.noteUnconfirmed}\n        retryLabel={c.retryNote}\n        {...(note.expired\n          ? { replaceText: c.noteExpired, stopLabel: c.dismiss }\n          : {})}\n      />\n    </section>\n  );\n}\n",
      "type": "registry:block",
      "target": "@components/casework/review-notes.tsx"
    }
  ],
  "type": "registry:block"
}