{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "dashboard-page",
  "title": "Dashboard page",
  "description": "A page pattern: a whole dashboard page: a header with the light and dark toggle, the numbers that matter in cards, a chart of the last months and a table of recent activity.",
  "registryDependencies": [
    "@ouro/badge",
    "@ouro/card",
    "@ouro/chart",
    "@ouro/color-scheme-toggle",
    "@ouro/heading",
    "@ouro/page-header",
    "@ouro/stack",
    "@ouro/table",
    "@ouro/text"
  ],
  "files": [
    {
      "path": "registry/ouro/patterns/dashboard-page/dashboard-page.tsx",
      "content": "import { Badge } from \"@/registry/ouro/components/ouro/badge/badge\";\nimport { Card } from \"@/registry/ouro/components/ouro/card/card\";\nimport { Chart } from \"@/registry/ouro/components/ouro/chart/chart\";\nimport { ColorSchemeToggle } from \"@/registry/ouro/components/ouro/color-scheme-toggle/color-scheme-toggle\";\nimport { PageHeader } from \"@/registry/ouro/components/ouro/page-header/page-header\";\nimport { Stack } from \"@/registry/ouro/components/ouro/stack/stack\";\nimport { Table } from \"@/registry/ouro/components/ouro/table/table\";\nimport { Heading } from \"@/registry/ouro/components/ouro/text/heading\";\nimport { Text } from \"@/registry/ouro/components/ouro/text/text\";\n\n/** A number the dashboard leads with, and how it moved. */\nexport interface Stat {\n  label: string;\n  value: string;\n  change: string;\n  trend: \"up\" | \"down\" | \"flat\";\n}\n\n/** A month of the chart: one value per series. */\nexport interface Month {\n  month: string;\n  orders: number;\n  returns: number;\n}\n\n/** A row of the recent activity table. */\nexport interface Activity {\n  id: string;\n  customer: string;\n  placed: string;\n  total: string;\n  status: \"Paid\" | \"Refunded\" | \"Pending\";\n}\n\n// Made-up data to show the page; replace it with your own.\nconst sampleStats: Stat[] = [\n  { label: \"Revenue\", value: \"$48,200\", change: \"+12% from last month\", trend: \"up\" },\n  { label: \"Orders\", value: \"1,284\", change: \"+4% from last month\", trend: \"up\" },\n  { label: \"Returns\", value: \"38\", change: \"-6% from last month\", trend: \"down\" },\n];\nconst sampleMonths: Month[] = [\n  { month: \"Jan\", orders: 860, returns: 40 },\n  { month: \"Feb\", orders: 920, returns: 36 },\n  { month: \"Mar\", orders: 1010, returns: 44 },\n  { month: \"Apr\", orders: 1180, returns: 41 },\n  { month: \"May\", orders: 1230, returns: 39 },\n  { month: \"Jun\", orders: 1284, returns: 38 },\n];\nconst sampleActivity: Activity[] = [\n  { id: \"1042\", customer: \"Mara Lind\", placed: \"Jun 28\", total: \"$120.00\", status: \"Paid\" },\n  { id: \"1041\", customer: \"Tomás Ruiz\", placed: \"Jun 28\", total: \"$64.50\", status: \"Pending\" },\n  { id: \"1040\", customer: \"Ada Osei\", placed: \"Jun 27\", total: \"$210.00\", status: \"Refunded\" },\n];\n\nconst trendTone = { up: \"success\", down: \"warning\", flat: \"secondary\" } as const;\nconst statusTone = { Paid: \"success\", Pending: \"secondary\", Refunded: \"warning\" } as const;\n\n/**\n * A whole dashboard page: a header with the light and dark toggle, the numbers that matter in cards, a chart of the\n * last months and a table of recent activity. It draws itself from Ouro's theme, with layout classes only. Render it\n * with your data, then change the cards and columns to what your app tracks.\n *\n * What it already does, which Ouro's own tests cover: each card is headed by its number, read with its label; with\n * no activity it says \"No activity yet.\" in place of the table; it renders from a Server Component, since it passes\n * no function to the client components inside it.\n *\n * What the app wires up: the toggle needs `ColorSchemeProvider` around the app, and the script that sets light or\n * dark before the first paint, as the agent quickstart sets up: https://ui.ouroboros.bot/docs/agent-quickstart.md.\n *\n * To change it, edit this file: the `Stat`, `Month` and `Activity` types and the sample data. The parts it uses take:\n * - `Chart`: `title` (with `hideTitle`), `data`, `categoryKey`, and `config`, a label and an optional `tone` per\n *   series; it draws bars unless `type` says otherwise.\n * - `Table`: `caption` (with `hideCaption`), `columns` (`{ key, header, align }`) and `rows`; put an element such as a\n *   `Badge` in a row's field rather than a `cell` function, which a Server Component can't pass.\n * - `Badge`: `tone` and `variant=\"soft\"`. `Heading`: `level` and `size`. `Text`: `size` and `tone`.\n * - `Card`: `title`, `headingLevel`. `PageHeader`: `title`, `description`, `actions`. `Stack`: `gap`.\n * A component's whole API is on its page, https://ui.ouroboros.bot/docs/<item>.md.\n *\n * @claim \"What it already does, which Ouro's own\" test/patterns.test.tsx verify:testExists(test/patterns.test.tsx::DashboardPage > is a whole page: a heading, a card per number, headed by the number with its label, with how it moved, a chart and the recent activity, and passes axe)\n * @claim \"What it already does, which Ouro's own\" test/patterns.test.tsx verify:testExists(test/patterns.test.tsx::DashboardPage > draws the numbers, months and rows it is given, and says when there is no activity)\n * @claim \"What it already does, which Ouro's own\" test/patterns.test.tsx verify:testExists(test/patterns.test.tsx::DashboardPage > is a Server Component that hands no function to the client components it renders)\n *\n * @example\n * import { DashboardPage } from \"@/components/patterns/dashboard-page\";\n * <DashboardPage stats={stats} months={months} activity={orders} />\n */\nexport function DashboardPage({\n  stats = sampleStats,\n  months = sampleMonths,\n  activity = sampleActivity,\n}: {\n  /** The numbers at the top, in cards. */\n  stats?: readonly Stat[];\n  /** The chart's months. */\n  months?: readonly Month[];\n  /** Recent rows of activity. */\n  activity?: readonly Activity[];\n}) {\n  return (\n    <main className=\"mx-auto w-full max-w-5xl px-4 py-10\">\n      <Stack gap=\"lg\">\n        <PageHeader title=\"Overview\" description=\"How the store is doing this month.\" actions={<ColorSchemeToggle />} />\n        <div className=\"grid gap-4 sm:grid-cols-3\">\n          {stats.map((stat) => (\n            <Card key={stat.label}>\n              <Stack gap=\"xs\">\n                <Text size=\"sm\" tone=\"muted\" aria-hidden=\"true\">\n                  {stat.label}\n                </Text>\n                {/* The number is the card's heading, read with its label: \"Revenue: $48,200\". */}\n                <Heading level={2} size=\"2xl\">\n                  <span className=\"sr-only\">{stat.label}: </span>\n                  {stat.value}\n                </Heading>\n                <div>\n                  <Badge tone={trendTone[stat.trend]} variant=\"soft\">\n                    {stat.change}\n                  </Badge>\n                </div>\n              </Stack>\n            </Card>\n          ))}\n        </div>\n        <Card title=\"Orders by month\" headingLevel={2}>\n          <Chart\n            title=\"Orders and returns by month\"\n            hideTitle\n            data={months}\n            categoryKey=\"month\"\n            config={{ orders: { label: \"Orders\" }, returns: { label: \"Returns\", tone: \"chart-2\" } }}\n            className=\"h-64\"\n          />\n        </Card>\n        <Stack gap=\"sm\">\n          <Heading level={2} size=\"lg\">\n            Recent activity\n          </Heading>\n          {activity.length > 0 ? (\n            <Table\n              caption=\"Recent activity\"\n              hideCaption\n              columns={[\n                { key: \"id\", header: \"Order\" },\n                { key: \"customer\", header: \"Customer\" },\n                { key: \"placed\", header: \"Placed\" },\n                { key: \"total\", header: \"Total\", align: \"end\" },\n                { key: \"status\", header: \"Status\" },\n              ]}\n              // Each badge is in its row's field, not a cell function, which a Server Component can't pass on.\n              rows={activity.map((row) => ({\n                ...row,\n                status: (\n                  <Badge tone={statusTone[row.status]} variant=\"soft\">\n                    {row.status}\n                  </Badge>\n                ),\n              }))}\n            />\n          ) : (\n            <Text tone=\"muted\">No activity yet.</Text>\n          )}\n        </Stack>\n      </Stack>\n    </main>\n  );\n}\n",
      "type": "registry:component",
      "target": "@components/patterns/dashboard-page.tsx"
    }
  ],
  "docs": "DashboardPage is in components/patterns/dashboard-page.tsx: render <DashboardPage /> and change it to what you are building. The comment above it says what it already does (Ouro tests that, so test only what you add), what your app wires up, and the props of the parts it uses. Docs: https://ui.ouroboros.bot/docs/patterns.md Ouro UI v1.3.342.",
  "type": "registry:block"
}