{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "template-cms",
  "title": "Local CMS workspace",
  "description": "A local content editor with search, status filters, dirty state, save recovery and preview.",
  "registryDependencies": [
    "@neumorphism-ui/alert",
    "@neumorphism-ui/badge",
    "@neumorphism-ui/button",
    "@neumorphism-ui/input",
    "@neumorphism-ui/switch",
    "@neumorphism-ui/textarea",
    "@neumorphism-ui/utils",
    "@neumorphism-ui/card"
  ],
  "files": [
    {
      "path": "src/components/blocks/cms.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nimport { Alert, AlertDescription, AlertTitle } from \"@/components/ui/alert\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Button } from \"@/components/ui/button\";\nimport { Card } from \"@/components/ui/card\";\nimport { Input } from \"@/components/ui/input\";\nimport { Switch } from \"@/components/ui/switch\";\nimport { Textarea } from \"@/components/ui/textarea\";\nimport { cn } from \"@/lib/utils\";\n\nexport type CmsLocale = \"ko\" | \"en\" | \"ja\" | \"zh\";\nexport type CmsPostStatus = \"draft\" | \"published\";\n\nexport type CmsPost = {\n  id: string;\n  title: string;\n  summary: string;\n  body: string;\n  status: CmsPostStatus;\n  updatedLabel?: string;\n};\n\nexport interface CmsWorkspaceProps {\n  initialPosts: readonly CmsPost[];\n  onSave?: (post: CmsPost) => Promise<void>;\n  locale?: CmsLocale;\n  className?: string;\n}\n\ntype EditablePost = CmsPost & { dirty: boolean };\ntype StatusFilter = \"all\" | CmsPostStatus;\n\nconst copy = {\n  ko: {\n    title: \"글 관리\",\n    intro: \"초안을 편집하고 미리보기로 확인한 뒤 저장하세요.\",\n    fail: \"다음 저장 실패 재현\",\n    newPost: \"새 글\",\n    total: \"전체 글\",\n    published: \"게시됨\",\n    unsaved: \"저장 안 됨\",\n    local: \"데모는 새로고침하면 초기화됩니다. 실제 저장은 onSave에 연결하세요.\",\n    search: \"글 검색\",\n    all: \"전체\",\n    draft: \"초안\",\n    editor: \"글 편집\",\n    updated: \"업데이트\",\n    unsavedChanges: \"저장하지 않은 변경\",\n    discard: \"변경 취소\",\n    save: \"저장\",\n    saving: \"저장 중…\",\n    titleField: \"제목\",\n    summary: \"요약\",\n    content: \"본문\",\n    preview: \"미리보기\",\n    publish: \"게시\",\n    noPosts: \"조건에 맞는 글이 없습니다.\",\n    clear: \"필터 초기화\",\n    saveFailed: \"저장하지 못했습니다.\",\n    saveRecovery: \"편집 내용은 유지됩니다. 다시 저장하거나 변경 취소로 마지막 저장 상태를 복원하세요.\",\n    saved: \"저장했습니다.\",\n    restored: \"마지막 저장 상태를 복원했습니다.\",\n    discarded: \"저장하지 않은 글을 삭제했습니다.\",\n    untitled: \"제목 없는 글\",\n  },\n  en: {\n    title: \"Posts\",\n    intro: \"Edit drafts, preview posts and save your changes.\",\n    fail: \"Fail the next save\",\n    newPost: \"New post\",\n    total: \"Total posts\",\n    published: \"Published\",\n    unsaved: \"Unsaved\",\n    local: \"Demo changes reset on reload. Connect onSave to store changes in your application.\",\n    search: \"Search posts\",\n    all: \"All\",\n    draft: \"Draft\",\n    editor: \"Edit post\",\n    updated: \"Updated\",\n    unsavedChanges: \"Unsaved changes\",\n    discard: \"Discard\",\n    save: \"Save\",\n    saving: \"Saving…\",\n    titleField: \"Title\",\n    summary: \"Summary\",\n    content: \"Content\",\n    preview: \"Read preview\",\n    publish: \"Published\",\n    noPosts: \"No posts match the current filters.\",\n    clear: \"Clear filters\",\n    saveFailed: \"Changes were not saved.\",\n    saveRecovery: \"Your edits are still here. Try again or discard to restore the last saved version.\",\n    saved: \"Saved.\",\n    restored: \"Restored the last saved version.\",\n    discarded: \"Discarded the unsaved post.\",\n    untitled: \"Untitled post\",\n  },\n  ja: {\n    title: \"記事管理\",\n    intro: \"下書きを編集し、プレビューで確認して保存します。\",\n    fail: \"次の保存を失敗させる\",\n    newPost: \"新規記事\",\n    total: \"全記事\",\n    published: \"公開済み\",\n    unsaved: \"未保存\",\n    local: \"ローカルUIの例です。実際の保存は onSave に接続してください。\",\n    search: \"記事を検索\",\n    all: \"すべて\",\n    draft: \"下書き\",\n    editor: \"記事を編集\",\n    updated: \"更新\",\n    unsavedChanges: \"未保存の変更\",\n    discard: \"変更を破棄\",\n    save: \"保存\",\n    saving: \"保存中…\",\n    titleField: \"タイトル\",\n    summary: \"概要\",\n    content: \"本文\",\n    preview: \"プレビュー\",\n    publish: \"公開\",\n    noPosts: \"条件に一致する記事がありません。\",\n    clear: \"フィルターをクリア\",\n    saveFailed: \"保存できませんでした。\",\n    saveRecovery: \"編集内容は残っています。再試行するか、破棄して最後の保存状態に戻してください。\",\n    saved: \"保存しました。\",\n    restored: \"最後の保存状態に戻しました。\",\n    discarded: \"未保存の記事を破棄しました。\",\n    untitled: \"無題の記事\",\n  },\n  zh: {\n    title: \"文章管理\",\n    intro: \"编辑草稿，预览文章并保存更改。\",\n    fail: \"模拟下次保存失败\",\n    newPost: \"新建文章\",\n    total: \"全部文章\",\n    published: \"已发布\",\n    unsaved: \"未保存\",\n    local: \"这是本地 UI 示例。请将 onSave 连接到已认证的持久化服务。\",\n    search: \"搜索文章\",\n    all: \"全部\",\n    draft: \"草稿\",\n    editor: \"编辑文章\",\n    updated: \"更新于\",\n    unsavedChanges: \"有未保存更改\",\n    discard: \"放弃更改\",\n    save: \"保存\",\n    saving: \"正在保存…\",\n    titleField: \"标题\",\n    summary: \"摘要\",\n    content: \"正文\",\n    preview: \"阅读预览\",\n    publish: \"已发布\",\n    noPosts: \"没有符合当前筛选条件的文章。\",\n    clear: \"清除筛选\",\n    saveFailed: \"未能保存更改。\",\n    saveRecovery: \"编辑内容仍然保留。请重试，或放弃更改以恢复上次保存的版本。\",\n    saved: \"已保存。\",\n    restored: \"已恢复上次保存的版本。\",\n    discarded: \"已放弃未保存的文章。\",\n    untitled: \"无标题文章\",\n  },\n} as const;\n\nfunction editable(posts: readonly CmsPost[]): EditablePost[] {\n  return posts.map((post) => ({ ...post, dirty: false }));\n}\n\nfunction displayTitle(post: CmsPost, untitled: string) {\n  return post.title.trim() || untitled;\n}\n\nexport function CmsWorkspace({\n  initialPosts,\n  onSave = async () => {},\n  locale = \"en\",\n  className,\n}: CmsWorkspaceProps) {\n  const t = copy[locale];\n  const publishId = React.useId();\n  const [posts, setPosts] = React.useState<EditablePost[]>(() => editable(initialPosts));\n  const [saved, setSaved] = React.useState<CmsPost[]>(() => initialPosts.map((post) => ({ ...post })));\n  const [selectedId, setSelectedId] = React.useState(initialPosts[0]?.id ?? \"\");\n  const [query, setQuery] = React.useState(\"\");\n  const [filter, setFilter] = React.useState<StatusFilter>(\"all\");\n  const [pending, setPending] = React.useState(false);\n  const [failure, setFailure] = React.useState(false);\n  const [feedback, setFeedback] = React.useState(\"\");\n\n  const filtered = posts.filter((post) => {\n    const text = (post.title + \" \" + post.summary).toLowerCase();\n    return (filter === \"all\" || post.status === filter) &&\n      text.includes(query.trim().toLowerCase());\n  });\n  const selected = posts.find((post) => post.id === selectedId);\n\n  function updateSelected(changes: Partial<Pick<CmsPost, \"title\" | \"summary\" | \"body\" | \"status\">>) {\n    if (!selected || pending) return;\n    const snapshot = saved.find((post) => post.id === selected.id);\n    setFailure(false);\n    setFeedback(\"\");\n    setPosts((current) =>\n      current.map((post) => {\n        if (post.id !== selected.id) return post;\n        const next = { ...post, ...changes };\n        next.dirty = !snapshot ||\n          next.title !== snapshot.title ||\n          next.summary !== snapshot.summary ||\n          next.body !== snapshot.body ||\n          next.status !== snapshot.status;\n        return next;\n      }),\n    );\n  }\n\n  async function saveSelected() {\n    if (!selected || !selected.dirty || pending) return;\n    const snapshot: CmsPost = {\n      id: selected.id,\n      title: displayTitle(selected, t.untitled),\n      summary: selected.summary.trim(),\n      body: selected.body.trim(),\n      status: selected.status,\n      updatedLabel: selected.updatedLabel,\n    };\n    setPending(true);\n    setFailure(false);\n    setFeedback(\"\");\n    try {\n      await onSave(snapshot);\n      setSaved((current) => [...current.filter((post) => post.id !== snapshot.id), snapshot]);\n      setPosts((current) =>\n        current.map((post) => post.id === snapshot.id ? { ...snapshot, dirty: false } : post),\n      );\n      setFeedback(t.saved);\n    } catch {\n      setFailure(true);\n    } finally {\n      setPending(false);\n    }\n  }\n\n  function discardSelected() {\n    if (!selected || pending) return;\n    const snapshot = saved.find((post) => post.id === selected.id);\n    if (snapshot) {\n      setPosts((current) =>\n        current.map((post) => post.id === selected.id ? { ...snapshot, dirty: false } : post),\n      );\n    } else {\n      setPosts((current) => current.filter((post) => post.id !== selected.id));\n      setSelectedId(posts.find((post) => post.id !== selected.id)?.id ?? \"\");\n    }\n    setFailure(false);\n    setFeedback(snapshot ? t.restored : t.discarded);\n  }\n\n  function createPost() {\n    if (pending) return;\n    const id = crypto.randomUUID();\n    const post: EditablePost = {\n      id,\n      title: t.untitled,\n      summary: \"\",\n      body: \"\",\n      status: \"draft\",\n      updatedLabel: \"\",\n      dirty: true,\n    };\n    setPosts((current) => [post, ...current]);\n    setSelectedId(id);\n    setQuery(\"\");\n    setFilter(\"all\");\n    setFailure(false);\n    setFeedback(\"\");\n  }\n\n  const publishedCount = posts.filter((post) => post.status === \"published\").length;\n  const unsavedCount = posts.filter((post) => post.dirty).length;\n\n  return (\n    <section data-slot=\"cms-workspace\" className={cn(\"@container/workspace grid min-w-0 gap-7 text-[var(--foreground)]\", className)}>\n      <header className=\"flex flex-wrap items-center justify-between gap-4 border-b border-[var(--border)] pb-4\">\n        <div>\n          <h2 className=\"text-2xl font-bold leading-tight tracking-tight\">{t.title}</h2>\n          <p className=\"mt-2 text-sm leading-relaxed text-[var(--muted-foreground)]\">{t.intro}</p>\n        </div>\n        <Button type=\"button\" onClick={createPost}><svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" className=\"size-4 shrink-0\"><path d=\"M12 5v14M5 12h14\" /></svg>{t.newPost}</Button>\n      </header>\n\n      <dl data-slot=\"workspace-metrics\" className=\"grid min-w-0 grid-cols-3 gap-3 @min-[36rem]/workspace:gap-5\">\n        {([\n          [\"total\", t.total, posts.length],\n          [\"published\", t.published, publishedCount],\n          [\"unsaved\", t.unsaved, unsavedCount],\n        ] as const).map(([key, text, count]) => (\n          <Card key={key} variant={key === \"published\" ? \"accent\" : \"raised\"} className=\"@container/metric grid grid-rows-[minmax(2.5rem,auto)_auto] min-h-32 min-w-0 content-center justify-items-center gap-2 rounded-[calc(var(--neu-radius-surface)*0.5)] px-3 py-5 text-center @min-[36rem]/workspace:px-5\">\n            <dt className={`row-start-2 min-h-[3em] max-w-full text-balance text-xs font-medium leading-normal [overflow-wrap:anywhere] ${key === \"published\" ? \"text-[var(--primary-foreground)]\" : \"text-[var(--muted-foreground)]\"}`}>{text}</dt>\n            <dd data-metric={key} className=\"row-start-1 m-0 max-w-full self-end text-[clamp(1.375rem,24cqi,2.25rem)] font-extrabold leading-[1.1] tracking-tight tabular-nums [overflow-wrap:anywhere]\">{count}</dd>\n          </Card>\n        ))}\n      </dl>\n\n      {feedback ? <p role=\"status\" className=\"text-sm text-[var(--muted-foreground)]\">{feedback}</p> : null}\n      {failure ? (\n        <Alert variant=\"destructive\">\n          <AlertTitle>{t.saveFailed}</AlertTitle>\n          <AlertDescription>{t.saveRecovery}</AlertDescription>\n        </Alert>\n      ) : null}\n\n      <div className=\"grid min-w-0 overflow-hidden rounded-[var(--neu-radius-surface)] border border-[color:var(--neu-edge)] bg-[var(--neu-surface)] shadow-none lg:grid-cols-[minmax(17rem,2fr)_minmax(22rem,3fr)]\">\n        <aside className=\"min-w-0 border-b border-[var(--border)] lg:border-r lg:border-b-0\">\n          <div className=\"grid gap-3 border-b border-[var(--border)] bg-[var(--neu-surface-soft)] p-3\">\n            <Input\n              aria-label={t.search}\n              type=\"search\"\n              placeholder={t.search}\n              value={query}\n              onChange={(event) => setQuery(event.target.value)}\n            />\n            <div role=\"group\" aria-label={t.search} className=\"grid grid-cols-3 gap-2\">\n              {([\n                [\"all\", t.all],\n                [\"draft\", t.draft],\n                [\"published\", t.published],\n              ] as const).map(([value, label]) => (\n                <Button\n                  key={value}\n                  type=\"button\"\n                  size=\"sm\"\n                  variant={filter === value ? \"primary\" : \"ghost\"}\n                  aria-pressed={filter === value}\n                  onClick={() => setFilter(value)}\n                >\n                  {label}\n                </Button>\n              ))}\n            </div>\n          </div>\n\n          {filtered.length ? (\n            <ul className=\"grid\">\n              {filtered.map((post) => (\n                <li key={post.id} className=\"border-b border-[var(--border)] last:border-b-0\">\n                  <button\n                    type=\"button\"\n                    aria-pressed={post.id === selectedId}\n                    onClick={() => { setSelectedId(post.id); setFailure(false); setFeedback(\"\"); }}\n                    className=\"grid w-full grid-cols-[minmax(0,1fr)_auto] gap-3 px-4 py-3 text-left outline-none hover:bg-[var(--neu-surface-soft)] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ring)] aria-pressed:bg-[var(--neu-surface-low)] aria-pressed:[box-shadow:var(--neu-shadow-inset-sm)]\"\n                  >\n                    <span className=\"min-w-0\">\n                      <span className=\"block truncate text-sm font-semibold\">{displayTitle(post, t.untitled)}</span>\n                      <span className=\"mt-1 block truncate text-xs text-[var(--muted-foreground)]\">{post.summary || \"—\"}</span>\n                    </span>\n                    <span className=\"grid justify-items-end gap-1\">\n                      <Badge variant={post.status === \"published\" ? \"primary\" : \"soft\"}>\n                        {post.status === \"published\" ? t.published : t.draft}\n                      </Badge>\n                      {post.dirty ? <span className=\"text-xs text-[var(--destructive)]\">{t.unsaved}</span> : null}\n                    </span>\n                  </button>\n                </li>\n              ))}\n            </ul>\n          ) : (\n            <div className=\"grid justify-items-center gap-3 p-8 text-center\">\n              <p className=\"text-sm text-[var(--muted-foreground)]\">{t.noPosts}</p>\n              <Button type=\"button\" size=\"sm\" onClick={() => { setQuery(\"\"); setFilter(\"all\"); }}>{t.clear}</Button>\n            </div>\n          )}\n        </aside>\n\n        <section aria-label={t.editor} className=\"min-w-0\">\n          {selected ? (\n            <form\n              className=\"grid min-h-[28rem] grid-rows-[auto_1fr]\"\n              aria-busy={pending}\n              onSubmit={(event) => { event.preventDefault(); void saveSelected(); }}\n            >\n              <header className=\"flex flex-wrap items-center justify-between gap-3 border-b border-[var(--border)] bg-[var(--neu-surface-soft)] p-4\">\n                <div>\n                  <h3 className=\"font-semibold\">{t.editor}</h3>\n                  <p className=\"mt-1 text-xs text-[var(--muted-foreground)]\">\n                    {selected.dirty ? t.unsavedChanges : (selected.updatedLabel ? t.updated + \" \" + selected.updatedLabel : \"—\")}\n                  </p>\n                </div>\n                <div className=\"flex gap-2\">\n                  <Button type=\"button\" size=\"sm\" disabled={!selected.dirty || pending} onClick={discardSelected}>{t.discard}</Button>\n                  <Button type=\"submit\" size=\"sm\" variant=\"primary\" disabled={!selected.dirty || pending}>{pending ? t.saving : t.save}</Button>\n                </div>\n              </header>\n\n              <div className=\"grid content-start gap-5 p-4 sm:p-5\">\n                <label className=\"grid gap-2 text-sm font-semibold\">\n                  {t.titleField}\n                  <Input required disabled={pending} value={selected.title} onChange={(event) => updateSelected({ title: event.target.value })} />\n                </label>\n                <label className=\"grid gap-2 text-sm font-semibold\">\n                  {t.summary}\n                  <Textarea disabled={pending} value={selected.summary} onChange={(event) => updateSelected({ summary: event.target.value })} />\n                </label>\n                <label className=\"grid gap-2 text-sm font-semibold\">\n                  {t.content}\n                  <Textarea disabled={pending} className=\"min-h-44\" value={selected.body} onChange={(event) => updateSelected({ body: event.target.value })} />\n                </label>\n\n                <details className=\"rounded-[var(--neu-radius-surface)] border border-[var(--border)] bg-[var(--neu-surface-soft)] p-4\">\n                  <summary className=\"cursor-pointer font-semibold\">{t.preview}</summary>\n                  <article className=\"mt-4 grid gap-3\">\n                    <Badge variant={selected.status === \"published\" ? \"primary\" : \"soft\"}>\n                      {selected.status === \"published\" ? t.published : t.draft}\n                    </Badge>\n                    <h4 className=\"text-xl font-semibold\">{displayTitle(selected, t.untitled)}</h4>\n                    <p className=\"text-sm text-[var(--muted-foreground)]\">{selected.summary || \"—\"}</p>\n                    <p className=\"whitespace-pre-wrap text-sm leading-relaxed\">{selected.body || \"—\"}</p>\n                  </article>\n                </details>\n\n                <div className=\"flex items-center justify-between gap-4 border-t border-[var(--border)] pt-4\">\n                  <label htmlFor={publishId} className=\"text-sm font-semibold\">{t.publish}</label>\n                  <Switch\n                    id={publishId}\n                    disabled={pending}\n                    checked={selected.status === \"published\"}\n                    onCheckedChange={(checked) => updateSelected({ status: checked ? \"published\" : \"draft\" })}\n                  />\n                </div>\n              </div>\n            </form>\n          ) : (\n            <div className=\"grid min-h-[28rem] place-content-center justify-items-center gap-3 p-6 text-center\">\n              <p className=\"text-sm text-[var(--muted-foreground)]\">{t.noPosts}</p>\n              <Button type=\"button\" onClick={createPost}>{t.newPost}</Button>\n            </div>\n          )}\n        </section>\n      </div>\n    </section>\n  );\n}\n\nconst examplePosts = {\n  \"en\": [\n    {\n      \"id\": \"post-1\",\n      \"title\": \"September editor update\",\n      \"summary\": \"Draft recovery and the post review checklist.\",\n      \"body\": \"The editor keeps the current draft when a save fails. Retry the request without re-entering the title or body.\",\n      \"status\": \"published\",\n      \"updatedLabel\": \"2026-09-18\"\n    },\n    {\n      \"id\": \"post-2\",\n      \"title\": \"Prepare a post for review\",\n      \"summary\": \"Check the title, summary and publication status.\",\n      \"body\": \"Confirm the title matches the article. Write a summary that names its topic. Keep the status as Draft until the reviewer approves publication.\",\n      \"status\": \"draft\",\n      \"updatedLabel\": \"2026-09-17\"\n    },\n    {\n      \"id\": \"post-3\",\n      \"title\": \"Assign a reviewer to each draft\",\n      \"summary\": \"Record the reviewer and the outstanding changes.\",\n      \"body\": \"Choose one reviewer for the draft. Collect requested changes in the article notes and confirm them before publishing.\",\n      \"status\": \"published\",\n      \"updatedLabel\": \"2026-09-16\"\n    }\n  ],\n  \"ko\": [\n    {\n      \"id\": \"post-1\",\n      \"title\": \"9월 편집기 업데이트\",\n      \"summary\": \"초안 복구와 글 검토 체크리스트.\",\n      \"body\": \"저장에 실패해도 현재 초안을 유지합니다. 제목과 본문을 다시 입력하지 않고 요청을 재시도할 수 있습니다.\",\n      \"status\": \"published\",\n      \"updatedLabel\": \"2026-09-18\"\n    },\n    {\n      \"id\": \"post-2\",\n      \"title\": \"검토할 글 준비하기\",\n      \"summary\": \"제목, 요약, 게시 상태를 확인합니다.\",\n      \"body\": \"제목이 본문 내용과 일치하는지 확인합니다. 주제가 드러나도록 요약을 작성합니다. 검토자가 게시를 승인하기 전까지 초안 상태를 유지합니다.\",\n      \"status\": \"draft\",\n      \"updatedLabel\": \"2026-09-17\"\n    },\n    {\n      \"id\": \"post-3\",\n      \"title\": \"초안마다 검토자 지정하기\",\n      \"summary\": \"담당 검토자와 남은 수정 사항을 기록합니다.\",\n      \"body\": \"초안의 검토자를 한 명 지정합니다. 요청된 변경 사항을 글 메모에 모으고 게시 전에 반영 여부를 확인합니다.\",\n      \"status\": \"published\",\n      \"updatedLabel\": \"2026-09-16\"\n    }\n  ],\n  \"ja\": [\n    {\n      \"id\": \"post-1\",\n      \"title\": \"9月の編集機能アップデート\",\n      \"summary\": \"下書きの復元と記事の確認リスト。\",\n      \"body\": \"保存に失敗しても現在の下書きを保持します。タイトルや本文を再入力せずに再試行できます。\",\n      \"status\": \"published\",\n      \"updatedLabel\": \"2026-09-18\"\n    },\n    {\n      \"id\": \"post-2\",\n      \"title\": \"記事をレビューに出す準備\",\n      \"summary\": \"タイトル、概要、公開状態を確認します。\",\n      \"body\": \"タイトルと本文が一致しているか確認します。概要には記事の話題を明記します。レビュー担当者が公開を承認するまでは下書きの状態にします。\",\n      \"status\": \"draft\",\n      \"updatedLabel\": \"2026-09-17\"\n    },\n    {\n      \"id\": \"post-3\",\n      \"title\": \"下書きにレビュー担当者を割り当てる\",\n      \"summary\": \"担当者と未対応の修正内容を記録します。\",\n      \"body\": \"下書きのレビュー担当者を一人決めます。修正依頼を記事のメモにまとめ、公開前に対応を確認します。\",\n      \"status\": \"published\",\n      \"updatedLabel\": \"2026-09-16\"\n    }\n  ],\n  \"zh\": [\n    {\n      \"id\": \"post-1\",\n      \"title\": \"九月编辑器更新\",\n      \"summary\": \"草稿恢复与文章审核清单。\",\n      \"body\": \"保存失败时保留当前草稿。无需重新输入标题或正文，即可重试请求。\",\n      \"status\": \"published\",\n      \"updatedLabel\": \"2026-09-18\"\n    },\n    {\n      \"id\": \"post-2\",\n      \"title\": \"准备待审核的文章\",\n      \"summary\": \"检查标题、摘要与发布状态。\",\n      \"body\": \"确认标题与正文相符。在摘要中明确文章主题。审核人员批准发布前，保持草稿状态。\",\n      \"status\": \"draft\",\n      \"updatedLabel\": \"2026-09-17\"\n    },\n    {\n      \"id\": \"post-3\",\n      \"title\": \"为每份草稿指定审核人\",\n      \"summary\": \"记录审核人和待完成的修改。\",\n      \"body\": \"为草稿指定一名审核人。将修改要求汇总到文章备注中，并在发布前确认完成情况。\",\n      \"status\": \"published\",\n      \"updatedLabel\": \"2026-09-16\"\n    }\n  ]\n} satisfies Record<CmsLocale, CmsPost[]>;\n\nexport function CmsExample({ locale = \"en\" }: { locale?: CmsLocale }) {\n  const [failNext, setFailNext] = React.useState(false);\n  const t = copy[locale];\n  return (\n    <div className=\"grid gap-4\">\n      <CmsWorkspace\n        initialPosts={examplePosts[locale]}\n        locale={locale}\n        onSave={async () => {\n          await new Promise((resolve) => setTimeout(resolve, 250));\n          if (failNext) {\n            setFailNext(false);\n            throw new Error(\"Simulated save failure\");\n          }\n        }}\n      />\n      <div data-demo-controls className=\"flex flex-wrap items-center justify-between gap-3 border-t border-[var(--border)] pt-4 text-xs leading-relaxed text-[var(--muted-foreground)]\">\n        <p className=\"max-w-xl\">{t.local}</p>\n        <label className=\"flex items-center gap-2\">\n          <input type=\"checkbox\" checked={failNext} onChange={(event) => setFailNext(event.target.checked)} />\n          {t.fail}\n        </label>\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "@components/blocks/cms.tsx"
    }
  ],
  "categories": [
    "template"
  ],
  "type": "registry:block"
}