{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "notifications-01",
  "description": "A bell menu listing the latest notifications, with a mark all as read action and a link to the inbox.",
  "registryDependencies": [
    "card",
    "https://www.dashboardblocks.com/r/radix/activity-feed.json",
    "https://www.dashboardblocks.com/r/radix/block-state.json",
    "https://www.dashboardblocks.com/r/radix/link.json",
    "https://www.dashboardblocks.com/r/radix/notifications.json"
  ],
  "files": [
    {
      "path": "registry/components/dashboardblocks/notifications/notifications-01.tsx",
      "content": "'use client'\n\nimport { MarkAllReadButton } from '@/registry/components/dashboardblocks/activity-feed'\nimport {\n  BlockReady,\n  BlockStateProvider,\n  BlockStateRows,\n  type BlockStateProps,\n  getBlockState,\n} from '@/registry/components/dashboardblocks/block-state'\nimport { Link } from '@/registry/components/dashboardblocks/link'\nimport {\n  type AppNotification,\n  NotificationBell,\n  NotificationItem,\n  NotificationList,\n  NotificationsHeader,\n} from '@/registry/components/dashboardblocks/notifications'\nimport { IconPlaceholder } from '@/registry/icons/icon-placeholder'\nimport { useState } from 'react'\n\nimport { Card, CardContent } from '@/components/ui/card'\n\ninterface Notifications1Props extends BlockStateProps {\n  /** Leave out, or pass none, to show the empty state. */\n  notifications?: AppNotification[]\n  /** Pass a fixed date, so times render the same on the server and in the browser. */\n  now: Date\n  title: string\n  viewAllHref: string\n}\n\nconst exampleNow = new Date(Date.UTC(2026, 8, 26, 12))\nconst minutesAgo = (minutes: number) => new Date(exampleNow.getTime() - minutes * 60_000)\n\nconst exampleProps: Notifications1Props = {\n  notifications: [\n    {\n      at: minutesAgo(4),\n      body: '“Can we ship the new pricing page before Friday?”',\n      icon: (\n        <IconPlaceholder\n          lucide='MessageSquareIcon'\n          tabler='IconMessage'\n          hugeicons='MessageIcon'\n          phosphor='ChatCircleIcon'\n          remixicon='RiChat1Line'\n        />\n      ),\n      id: '1',\n      read: false,\n      title: (\n        <>\n          <span className='font-medium'>Priya Nair</span> mentioned you in Pricing v3\n        </>\n      ),\n      tone: 'info',\n    },\n    {\n      at: minutesAgo(42),\n      icon: (\n        <IconPlaceholder\n          lucide='TriangleAlertIcon'\n          tabler='IconAlertTriangle'\n          hugeicons='Alert02Icon'\n          phosphor='WarningIcon'\n          remixicon='RiErrorWarningLine'\n        />\n      ),\n      id: '2',\n      read: false,\n      title: 'Checkout error rate passed 2% in eu-central-1',\n      tone: 'warning',\n    },\n    {\n      at: minutesAgo(180),\n      icon: (\n        <IconPlaceholder\n          lucide='CircleCheckIcon'\n          tabler='IconCircleCheckFilled'\n          hugeicons='CheckmarkCircle01Icon'\n          phosphor='CheckCircleIcon'\n          remixicon='RiCheckboxCircleFill'\n        />\n      ),\n      id: '3',\n      read: false,\n      title: 'Your export of 2,481 customers is ready',\n      tone: 'success',\n    },\n    {\n      at: minutesAgo(1_500),\n      icon: (\n        <IconPlaceholder\n          lucide='UserPlusIcon'\n          tabler='IconUserPlus'\n          hugeicons='UserAdd01Icon'\n          phosphor='UserPlusIcon'\n          remixicon='RiUserAddLine'\n        />\n      ),\n      id: '4',\n      read: true,\n      title: (\n        <>\n          <span className='font-medium'>Mateo Silva</span> joined your workspace\n        </>\n      ),\n    },\n  ],\n  now: exampleNow,\n  title: 'Dashboard',\n  viewAllHref: '#',\n}\n\nconst Notifications1 = (props: Notifications1Props) => {\n  const {\n    notifications: loaded = [],\n    now,\n    errorMessage,\n    status,\n    title,\n    viewAllHref,\n  } = props\n  const [readIds, setReadIds] = useState<ReadonlySet<string>>(() => new Set())\n  const state = getBlockState(status, loaded)\n  const notifications = loaded.map((notification) =>\n    readIds.has(notification.id) ? { ...notification, read: true } : notification,\n  )\n  const unread = state\n    ? 0\n    : notifications.filter((notification) => !notification.read).length\n\n  function markRead(ids: string[]) {\n    setReadIds((current) => new Set([...current, ...ids]))\n  }\n\n  return (\n    <BlockStateProvider errorMessage={errorMessage} state={state}>\n      <Card>\n        <CardContent>\n          <section className='@container flex items-center justify-between gap-3'>\n            <h2 className='font-semibold tracking-tight'>{title}</h2>\n            <NotificationBell unreadCount={unread}>\n              <NotificationsHeader\n                description={\n                  <BlockReady>\n                    {unread > 0 ? `${unread} unread.` : 'You’re all caught up.'}\n                  </BlockReady>\n                }\n                action={\n                  unread > 0 && (\n                    <MarkAllReadButton\n                      onClick={() =>\n                        markRead(notifications.map((notification) => notification.id))\n                      }\n                    />\n                  )\n                }\n              />\n              {state && (\n                <div className='border-y px-4'>\n                  <BlockStateRows rows={4} />\n                </div>\n              )}\n              {!state && (\n                <NotificationList className='max-h-96 overflow-y-auto border-y pe-2 [scrollbar-width:thin]'>\n                  {notifications.map((notification) => (\n                    <NotificationItem\n                      key={notification.id}\n                      notification={notification}\n                      now={now}\n                      onOpen={() => markRead([notification.id])}\n                    />\n                  ))}\n                </NotificationList>\n              )}\n              <Link\n                href={viewAllHref}\n                className='hover:bg-muted/50 focus-visible:bg-muted/50 rounded-b-[inherit] px-4 py-2.5 text-center text-sm font-medium outline-none'\n              >\n                View all notifications\n              </Link>\n            </NotificationBell>\n          </section>\n        </CardContent>\n      </Card>\n    </BlockStateProvider>\n  )\n}\n\nexport {\n  Notifications1,\n  exampleProps as notifications1ExampleProps,\n  type Notifications1Props,\n}\n",
      "type": "registry:component",
      "target": "@components/dashboardblocks/notifications/notifications-01.tsx"
    }
  ],
  "meta": {
    "shows": "A bell menu listing the latest notifications, with a mark all as read action and a link to the inbox.",
    "size": "half",
    "usedWith": [
      "notifications-03",
      "app-shell-01"
    ],
    "component": "Notifications1",
    "props": "{ notifications?: { at: Date; body?: string; href?: string; icon: ReactNode; id: string; read: boolean; title: ReactNode; tone?: \"success\" | \"warning\" | \"danger\" | \"info\" | \"neutral\" | \"accent\" }[]; now: Date; title: string; viewAllHref: string; errorMessage?: string; status?: \"loading\" | \"error\" }"
  },
  "type": "registry:component"
}
