{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "trial-bar-app-shell",
  "title": "Trial Bar App Shell",
  "description": "An app shell header with a trial bar computed from the trial end date, that hides for paying customers, turns urgent in the last three days and says ended after expiry.",
  "registryDependencies": [
    "@tealmac/trial-bar"
  ],
  "files": [
    {
      "path": "registry/patterns/trial-bar-app-shell/trial-bar-app-shell.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { TrialBar } from \"@/components/ui/trial-bar\"\n\nexport interface TrialBarAppShellProps {\n  /** ISO date when the trial ends, or null for a paying customer. */\n  trialEndsAt: string | null\n  plan: string\n  upgradeHref: string\n  /** Length of the trial in days. Default 14. */\n  totalDays?: number\n  children: React.ReactNode\n  /** Clock override for tests. */\n  now?: () => number\n}\n\nconst DAY = 86400000\n\n/**\n * The shell owns the one place people see their billing state. Days left are\n * computed from the end date (rounded up, so \"1 day left\" lasts until the very\n * end), a paying customer sees no bar at all, and after expiry the bar stays\n * with a clear \"ended\" message and the same upgrade link. The bar is the first\n * landmark-free element of the page, above the content.\n */\nexport function TrialBarAppShell({\n  trialEndsAt,\n  plan,\n  upgradeHref,\n  totalDays = 14,\n  children,\n  now = Date.now,\n}: TrialBarAppShellProps) {\n  const left =\n    trialEndsAt === null\n      ? null\n      : Math.ceil((Date.parse(trialEndsAt) - now()) / DAY)\n\n  return (\n    <div className=\"bg-background w-full overflow-hidden rounded-xl border\">\n      {left !== null ? (\n        <TrialBar\n          daysLeft={left}\n          totalDays={totalDays}\n          plan={plan}\n          action={\n            <a href={upgradeHref}>\n              {left <= 0 ? \"Choose a plan to continue\" : \"Upgrade\"}\n            </a>\n          }\n        />\n      ) : null}\n      <main className=\"p-5 text-sm\">{children}</main>\n    </div>\n  )\n}\n",
      "type": "registry:block"
    }
  ],
  "type": "registry:block"
}