{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "error-pages",
  "title": "Error Pages",
  "description": "Primitives for error and interruption pages: a full-page frame with your brand, a centred message, an optional code and icon, actions and footer links, plus UTC time and duration formatting.",
  "files": [
    {
      "path": "registry/components/dashboardblocks/error-pages.tsx",
      "content": "'use client'\n\nimport { type ReactNode, useEffect, useRef } from 'react'\n\nimport { cn } from '@/lib/utils'\n\ninterface ErrorPageLayoutProps {\n  /** `start` keeps the content at the top, for a page whose parts come and go while it's open. @default 'center' */\n  align?: 'center' | 'start'\n  /** Centres the visual, title and description over the content. */\n  centered?: boolean\n  /** Moves focus to the title on mount, so screen readers announce the error after a client-side navigation. */\n  focusOnMount?: boolean\n  children?: ReactNode\n  className?: string\n  brand?: ReactNode\n  code?: string\n  description?: ReactNode\n  footer?: ReactNode\n  title: ReactNode\n  /** The title's id, so the page can move focus to it. */\n  titleId?: string\n  /** Shown above the code and title, such as a countdown. */\n  visual?: ReactNode\n  /** A wider column, for a page that sets two panels side by side. */\n  wide?: boolean\n}\n\nfunction ErrorPageLayout({\n  align = 'center',\n  centered = false,\n  focusOnMount = false,\n  brand,\n  children,\n  className,\n  code,\n  description,\n  footer,\n  title,\n  titleId,\n  visual,\n  wide = false,\n}: ErrorPageLayoutProps) {\n  const headingRef = useRef<HTMLHeadingElement>(null)\n  const focused = useRef(false)\n\n  useEffect(() => {\n    if (!focusOnMount || focused.current) return\n    focused.current = true\n    headingRef.current?.focus()\n  }, [focusOnMount])\n\n  return (\n    <div\n      className={cn('bg-background @container/page flex min-h-svh flex-col', className)}\n    >\n      {brand && (\n        <header className='flex h-16 shrink-0 items-center px-4 sm:px-6'>\n          <div className='flex min-w-0 items-center gap-2 text-sm font-medium'>\n            {brand}\n          </div>\n        </header>\n      )}\n      <main\n        className={cn(\n          'flex flex-1 flex-col items-center px-4 py-12 sm:px-6',\n          align === 'center' && 'justify-center',\n        )}\n      >\n        <div\n          className={cn(\n            'flex w-full flex-col gap-6',\n            wide ? 'max-w-xl' : 'max-w-lg',\n            centered && 'items-center',\n          )}\n        >\n          {visual}\n          <div\n            className={cn('flex flex-col gap-2', centered && 'items-center text-center')}\n          >\n            {code && (\n              <p className='text-muted-foreground text-5xl font-light tracking-tight tabular-nums'>\n                {code}\n              </p>\n            )}\n            <h1\n              id={titleId}\n              ref={headingRef}\n              tabIndex={-1}\n              className='text-2xl font-semibold tracking-tight text-balance outline-none'\n            >\n              {title}\n            </h1>\n            {description && (\n              <p className='text-muted-foreground text-pretty'>{description}</p>\n            )}\n          </div>\n          {children && <div className='flex w-full flex-col gap-6'>{children}</div>}\n        </div>\n      </main>\n      {footer && (\n        <footer className='text-muted-foreground flex justify-center px-4 py-6 text-sm sm:px-6'>\n          <div className='flex w-full max-w-lg flex-wrap items-center gap-x-4 gap-y-1'>\n            {footer}\n          </div>\n        </footer>\n      )}\n    </div>\n  )\n}\n\nfunction formatDuration(milliseconds: number) {\n  const minutes = Math.round(milliseconds / 60_000)\n  if (minutes < 1) return 'less than a minute'\n  if (minutes < 60) return `about ${minutes} ${minutes === 1 ? 'minute' : 'minutes'}`\n  const hours = Math.round(minutes / 60)\n  return `about ${hours} ${hours === 1 ? 'hour' : 'hours'}`\n}\n\nexport { ErrorPageLayout, formatDuration }\n\nexport type { ErrorPageLayoutProps }\n",
      "type": "registry:component",
      "target": "@components/dashboardblocks/error-pages.tsx"
    }
  ],
  "type": "registry:component"
}
