{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "dashboard-routes",
  "title": "Dashboard routes",
  "description": "The dashboard's two routes and its navigation entry, for an app to list beside its own, and the hook that tells the navigation whether the host serves a dashboard.",
  "dependencies": [
    "@registrystack/app-runtime@~0.43.0-next.0",
    "lucide-react@1.43.0"
  ],
  "registryDependencies": [
    "@registrystack/pages-dashboard",
    "@registrystack/dashboard-records",
    "@registrystack/dashboard-cells",
    "@registrystack/pages-app-routes",
    "@registrystack/pages-lazy-pages",
    "@registrystack/shell-navigation"
  ],
  "files": [
    {
      "path": "dashboard/dashboard-routes.tsx",
      "content": "import { useMemo } from \"react\";\nimport { BarChart3 } from \"lucide-react\";\nimport { useDashboard } from \"@registrystack/app-runtime/react\";\nimport {\n  dashboardRecordsPath,\n  dashboardRoute,\n} from \"@/blocks/dashboard/dashboard-target\";\nimport {\n  exactPath,\n  route,\n  type AppRoute,\n  type NavEntry,\n} from \"@/blocks/pages/app-routes\";\nimport {\n  DashboardPage,\n  DashboardRecordsPage,\n} from \"@/blocks/pages/lazy-pages\";\nimport type { ShellNavItem } from \"@/blocks/shell/navigation\";\n\n/**\n * The dashboard's pages, for an app to list beside its own routes. The pages\n * exist only where the host serves a dashboard; `dashboardNavEntry` offers\n * the place in the navigation under the same condition.\n */\nexport const dashboardRoutes: AppRoute[] = [\n  route(\"dashboard\", exactPath(dashboardRoute), () => <DashboardPage />),\n  route(\"dashboard-records\", exactPath(dashboardRecordsPath), () => (\n    <DashboardRecordsPage />\n  )),\n];\n\n/** What the navigation entry reads: the dashboard the host serves, or none. */\nexport interface DashboardNavContext {\n  dashboard: { title: string } | null;\n}\n\n/**\n * The dashboard the host serves, for the navigation context; null while it\n * is read, where it failed to read, and where the register has none.\n */\nexport function useDashboardNav(): DashboardNavContext[\"dashboard\"] {\n  const title = useDashboard().data?.dashboard?.title;\n  return useMemo(() => (title === undefined ? null : { title }), [title]);\n}\n\n/** The dashboard's place in a navigation, named by the dashboard's own title. */\nexport const dashboardNavEntry: NavEntry<DashboardNavContext, ShellNavItem> = {\n  id: \"dashboard\",\n  items: ({ dashboard }) =>\n    dashboard\n      ? [{ path: dashboardRoute, label: dashboard.title, icon: BarChart3 }]\n      : [],\n};\n",
      "type": "registry:block",
      "target": "@components/dashboard/dashboard-routes.tsx"
    }
  ],
  "type": "registry:block"
}