{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "shell-status-badge",
  "title": "Status badge",
  "description": "A record or task's status, worded from the content model by its code, with a fallback for an unmapped one.",
  "registryDependencies": [
    "@registrystack/shell-content"
  ],
  "files": [
    {
      "path": "shell/status-badge.tsx",
      "content": "import { useShellContent } from \"@/blocks/shell/shell-content\";\n\nconst unknownStatusCodes = new Set<string>();\n\n/**\n * A record or task's status, worded from the content model by its code: by\n * the first of `labelKeys` the content labels, or by the code alone.\n */\nexport function StatusBadge({\n  state,\n  served,\n  labelKeys = [state],\n}: {\n  state: string;\n  served?: string;\n  labelKeys?: readonly string[];\n}) {\n  const c = useShellContent();\n  const label =\n    labelKeys\n      .map((key) => c.stateLabels[key])\n      .find((words) => words !== undefined) ??\n    c.recordedStatuses[state] ??\n    served;\n  if (label === undefined && !unknownStatusCodes.has(state)) {\n    unknownStatusCodes.add(state);\n    console.warn(`No content label for status \"${state}\"; using the fallback.`);\n  }\n  return (\n    <span className={`badge badge-${state.replace(/[^a-z-]/g, \"\")}`}>\n      {label ?? c.unknownStatus}\n    </span>\n  );\n}\n",
      "type": "registry:block",
      "target": "@components/shell/status-badge.tsx"
    }
  ],
  "type": "registry:block"
}