{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "status-01",
  "description": "Each service with its current status, the worst one above the title, and a sentence naming the services that are not operational.",
  "registryDependencies": [
    "card",
    "https://www.dashboardblocks.com/r/radix/block-state.json",
    "https://www.dashboardblocks.com/r/radix/status.json"
  ],
  "files": [
    {
      "path": "registry/components/dashboardblocks/status/status-01.tsx",
      "content": "'use client'\n\nimport {\n  BlockReady,\n  BlockStateProvider,\n  BlockStateRows,\n  type BlockStateProps,\n  getBlockState,\n} from '@/registry/components/dashboardblocks/block-state'\nimport {\n  StatusIndicator,\n  type StatusLevel,\n  getWorstStatus,\n  statusConfig,\n} from '@/registry/components/dashboardblocks/status'\nimport { formatList } from '@/registry/lib/dashboardblocks/format'\n\nimport { Card, CardContent } from '@/components/ui/card'\n\ninterface Service {\n  description?: string\n  name: string\n  status: StatusLevel\n}\n\ninterface Status1Props extends BlockStateProps {\n  /** Defaults to a sentence naming every service that isn't operational. */\n  description?: string\n  /** Leave out, or pass none, to show the empty state. */\n  services?: Service[]\n  title: string\n  /** Follows the description, such as `Updated 2 minutes ago.` */\n  updated?: string\n}\n\nconst exampleProps: Status1Props = {\n  services: [\n    {\n      description: 'Dashboard and settings',\n      name: 'Web app',\n      status: 'operational',\n    },\n    {\n      description: 'REST and GraphQL endpoints',\n      name: 'API',\n      status: 'degraded',\n    },\n    {\n      description: 'Event ingestion and delivery',\n      name: 'Webhooks',\n      status: 'operational',\n    },\n    {\n      description: 'Scheduled exports',\n      name: 'Background jobs',\n      status: 'maintenance',\n    },\n    {\n      description: 'Email and SMS',\n      name: 'Notifications',\n      status: 'operational',\n    },\n  ],\n  title: 'System status',\n  updated: 'Updated 2 minutes ago.',\n}\n\nconst summaryLabel: Record<StatusLevel, string> = {\n  degraded: 'Degraded performance',\n  maintenance: 'Maintenance in progress',\n  major: 'Major outage',\n  operational: 'All systems operational',\n  partial: 'Partial outage',\n  unknown: 'Status unknown',\n}\n\nconst summarize = (services: Service[]) => {\n  const affected = services.filter((service) => service.status !== 'operational')\n  if (affected.length === 0) return `All ${services.length} services are operational.`\n  const states = affected.map(\n    (service) => `${service.name} ${statusConfig[service.status].phrase}`,\n  )\n  const rest = services.length - affected.length\n  if (rest === 0) return `${formatList(states)}.`\n  return `${formatList(states)}; the other ${rest} ${rest === 1 ? 'is' : 'are'} operational.`\n}\n\nconst Status1 = (props: Status1Props) => {\n  const { services = [], errorMessage, status, title, updated } = props\n  const { description = summarize(services) } = props\n  const state = getBlockState(status, services)\n  const overall = getWorstStatus(services.map((service) => service.status))\n\n  return (\n    <Card>\n      <CardContent>\n        <BlockStateProvider errorMessage={errorMessage} state={state}>\n          <section className='@container flex flex-col gap-3'>\n            <header className='flex flex-col gap-1'>\n              <BlockReady className='w-40 text-sm'>\n                <StatusIndicator label={summaryLabel[overall]} status={overall} />\n              </BlockReady>\n              <div className='flex min-w-0 flex-col gap-0.5'>\n                <h2 className='font-semibold tracking-tight'>{title}</h2>\n                <BlockReady className='text-sm'>\n                  <p className='text-muted-foreground text-sm'>\n                    {description}\n                    {updated && ` ${updated}`}\n                  </p>\n                </BlockReady>\n              </div>\n            </header>\n            {state && (\n              <div className='border-t'>\n                <BlockStateRows rows={5} />\n              </div>\n            )}\n            {!state && (\n              <ul className='flex flex-col border-t'>\n                {services.map((service) => (\n                  <li\n                    key={service.name}\n                    className='flex items-center justify-between gap-4 border-b py-2.5 last:border-b-0'\n                  >\n                    <div className='flex min-w-0 flex-col'>\n                      <span className='text-sm font-medium'>{service.name}</span>\n                      {service.description && (\n                        <span className='text-muted-foreground text-xs'>\n                          {service.description}\n                        </span>\n                      )}\n                    </div>\n                    <StatusIndicator className='shrink-0' status={service.status} />\n                  </li>\n                ))}\n              </ul>\n            )}\n          </section>\n        </BlockStateProvider>\n      </CardContent>\n    </Card>\n  )\n}\n\nexport { Status1, exampleProps as status1ExampleProps, type Status1Props }\n",
      "type": "registry:component",
      "target": "@components/dashboardblocks/status/status-01.tsx"
    }
  ],
  "meta": {
    "shows": "Each service with its current status, the worst one above the title, and a sentence naming the services that are not operational.",
    "size": "half",
    "usedWith": [
      "status-03",
      "alerts-01",
      "data-table-04"
    ],
    "component": "Status1",
    "props": "{ description?: string; services?: { description?: string; name: string; status: \"operational\" | \"degraded\" | \"partial\" | \"major\" | \"maintenance\" | \"unknown\" }[]; title: string; updated?: string; errorMessage?: string; status?: \"loading\" | \"error\" }"
  },
  "type": "registry:component"
}
