{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "timeline-01",
  "description": "Projects grouped by team, each a bar from start to end filled to its progress, with a line for today.",
  "registryDependencies": [
    "card",
    "https://www.dashboardblocks.com/r/radix/block-state.json",
    "https://www.dashboardblocks.com/r/radix/timeline.json"
  ],
  "files": [
    {
      "path": "registry/components/dashboardblocks/timeline/timeline-01.tsx",
      "content": "'use client'\n\nimport {\n  BlockReady,\n  BlockStateProvider,\n  type BlockStateProps,\n  getBlockState,\n} from '@/registry/components/dashboardblocks/block-state'\nimport {\n  Timeline,\n  type TimelineItem,\n  TimelineStatusLabel,\n  type TimelineStatus,\n} from '@/registry/components/dashboardblocks/timeline'\n\nimport { Card, CardContent } from '@/components/ui/card'\n\ninterface Timeline1Props extends BlockStateProps {\n  /** Defaults to a sentence about how many projects are running and at risk. */\n  description?: string\n  end: Date\n  /** Leave out, or pass none, to show the empty state. */\n  items?: TimelineItem[]\n  /** Pass a fixed date, so the block renders the same on the server and in the browser. */\n  now: Date\n  start: Date\n  title: string\n}\n\nconst date = (month: number, day: number) => new Date(Date.UTC(2026, month - 1, day))\n\nconst exampleProps: Timeline1Props = {\n  end: date(12, 31),\n  items: [\n    {\n      end: date(8, 14),\n      group: 'Platform',\n      id: 'sso',\n      label: 'SSO and SCIM',\n      progress: 1,\n      start: date(7, 1),\n      status: 'done',\n    },\n    {\n      end: date(10, 23),\n      group: 'Platform',\n      id: 'audit',\n      label: 'Audit log export',\n      progress: 0.62,\n      start: date(8, 17),\n      status: 'in-progress',\n    },\n    {\n      end: date(12, 11),\n      group: 'Platform',\n      id: 'regions',\n      label: 'EU data residency',\n      progress: 0.18,\n      start: date(9, 14),\n      status: 'at-risk',\n    },\n    {\n      end: date(9, 4),\n      group: 'Growth',\n      id: 'onboarding',\n      label: 'New onboarding',\n      progress: 1,\n      start: date(7, 13),\n      status: 'done',\n    },\n    {\n      end: date(11, 6),\n      group: 'Growth',\n      id: 'pricing',\n      label: 'Usage-based pricing',\n      progress: 0.44,\n      start: date(8, 31),\n      status: 'in-progress',\n    },\n    {\n      end: date(12, 18),\n      group: 'Growth',\n      id: 'referrals',\n      label: 'Referral program',\n      start: date(11, 2),\n      status: 'planned',\n    },\n    {\n      end: date(10, 9),\n      group: 'Mobile',\n      id: 'offline',\n      label: 'Offline mode',\n      progress: 0.81,\n      start: date(7, 20),\n      status: 'in-progress',\n    },\n    {\n      end: date(12, 31),\n      group: 'Mobile',\n      id: 'widgets',\n      label: 'Home screen widgets',\n      start: date(10, 19),\n      status: 'planned',\n    },\n  ],\n  now: date(9, 26),\n  start: date(7, 1),\n  title: 'Product roadmap',\n}\n\nconst STATUSES: TimelineStatus[] = ['done', 'in-progress', 'at-risk', 'planned']\n\nconst summarize = (items: TimelineItem[]) => {\n  const teams = new Set(items.map((item) => item.group).filter(Boolean)).size\n  const running = items.filter((item) => item.status === 'in-progress').length\n  const atRisk = items.filter((item) => item.status === 'at-risk').length\n  const projects = `${items.length} ${items.length === 1 ? 'project' : 'projects'}`\n  const across = teams > 1 ? ` across ${teams} teams` : ''\n  const risk = atRisk > 0 ? `, and ${atRisk} at risk` : ''\n  return `${projects}${across}. ${running} in progress${risk}.`\n}\n\nconst Timeline1 = (props: Timeline1Props) => {\n  const { end, items = [], now, start, errorMessage, status, title } = props\n  const { description = summarize(items) } = props\n  const state = getBlockState(status, items)\n  const counts = STATUSES.map((itemStatus) => ({\n    count: items.filter((item) => item.status === itemStatus).length,\n    status: itemStatus,\n  })).filter((entry) => entry.count > 0)\n\n  return (\n    <BlockStateProvider errorMessage={errorMessage} state={state}>\n      <Card>\n        <CardContent>\n          <section className='@container flex flex-col gap-4'>\n            <header className='flex flex-wrap items-end justify-between gap-x-6 gap-y-2'>\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'>{description}</p>\n                </BlockReady>\n              </div>\n              {!state && (\n                <ul className='flex flex-wrap gap-x-4 gap-y-1'>\n                  {counts.map((entry) => (\n                    <li key={entry.status} className='flex items-center gap-1.5 text-sm'>\n                      <TimelineStatusLabel showLabel status={entry.status} />\n                      <span className='text-muted-foreground tabular-nums'>\n                        {entry.count}\n                      </span>\n                    </li>\n                  ))}\n                </ul>\n              )}\n            </header>\n            <Timeline\n              className='border-t pt-4'\n              end={end}\n              items={items}\n              label={title}\n              minWidth='40rem'\n              now={now}\n              placeholderRows={8}\n              start={start}\n            >\n              Bars fill to each project&apos;s progress. Hover one for its dates.\n            </Timeline>\n          </section>\n        </CardContent>\n      </Card>\n    </BlockStateProvider>\n  )\n}\n\nexport { Timeline1, exampleProps as timeline1ExampleProps, type Timeline1Props }\n",
      "type": "registry:component",
      "target": "@components/dashboardblocks/timeline/timeline-01.tsx"
    }
  ],
  "meta": {
    "shows": "Projects grouped by team, each a bar from start to end filled to its progress, with a line for today.",
    "size": "full",
    "usedWith": [
      "timeline-02",
      "timeline-04",
      "pipeline-01"
    ],
    "component": "Timeline1",
    "props": "{ description?: string; end: Date; items?: { color?: string; end: Date; group?: string; id: string; label: string; progress?: number; start: Date; status?: \"done\" | \"in-progress\" | \"planned\" | \"at-risk\" }[]; now: Date; start: Date; title: string; errorMessage?: string; status?: \"loading\" | \"error\" }"
  },
  "type": "registry:component"
}
