{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "notification-settings",
  "title": "Notification settings",
  "description": "Per-channel notification preferences grouped by topic.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "button",
    "card",
    "checkbox",
    "label",
    "switch"
  ],
  "files": [
    {
      "path": "registry/blocks/settings/notification-settings.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Bell, Mail, MessageSquare, Smartphone } from \"lucide-react\"\nimport { Button } from \"@/components/ui/button\"\nimport { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from \"@/components/ui/card\"\nimport { Checkbox } from \"@/components/ui/checkbox\"\nimport { Label } from \"@/components/ui/label\"\nimport { Switch } from \"@/components/ui/switch\"\n\nconst CHANNELS = [\n  { id: \"email\", label: \"Email\", icon: Mail },\n  { id: \"push\", label: \"Push\", icon: Smartphone },\n  { id: \"sms\", label: \"SMS\", icon: MessageSquare },\n] as const\ntype Channel = (typeof CHANNELS)[number][\"id\"]\n\nconst GROUPS: { title: string; items: { id: string; label: string; hint: string; defaults: Channel[] }[] }[] = [\n  {\n    title: \"Bookings\",\n    items: [\n      { id: \"new\", label: \"New booking\", hint: \"A client books an appointment\", defaults: [\"email\", \"push\"] },\n      { id: \"cancel\", label: \"Cancellations\", hint: \"A client cancels or reschedules\", defaults: [\"email\", \"push\", \"sms\"] },\n      { id: \"reminder\", label: \"Daily agenda\", hint: \"Your schedule every morning at 7:00\", defaults: [\"email\"] },\n    ],\n  },\n  {\n    title: \"Payments\",\n    items: [\n      { id: \"paid\", label: \"Payment received\", hint: \"Deposits and full payments\", defaults: [\"email\"] },\n      { id: \"failed\", label: \"Failed payment\", hint: \"A card is declined\", defaults: [\"email\", \"push\"] },\n    ],\n  },\n  {\n    title: \"Team\",\n    items: [\n      { id: \"mention\", label: \"Mentions\", hint: \"Someone @mentions you in a note\", defaults: [\"push\"] },\n      { id: \"joined\", label: \"Member joined\", hint: \"An invitation is accepted\", defaults: [] },\n    ],\n  },\n]\n\nconst initial = () => Object.fromEntries(GROUPS.flatMap((g) => g.items.map((i) => [i.id, new Set(i.defaults)]))) as Record<string, Set<Channel>>\n\nexport default function NotificationSettings() {\n  const [prefs, setPrefs] = React.useState(initial)\n  const [paused, setPaused] = React.useState(false)\n  const [dirty, setDirty] = React.useState(false)\n\n  const toggle = (id: string, ch: Channel, on: boolean) => {\n    setPrefs((p) => {\n      const next = new Set(p[id])\n      if (on) next.add(ch)\n      else next.delete(ch)\n      return { ...p, [id]: next }\n    })\n    setDirty(true)\n  }\n\n  return (\n    <div className=\"p-4 md:p-6\">\n      <Card className=\"mx-auto max-w-3xl\">\n        <CardHeader>\n          <CardTitle>Notifications</CardTitle>\n          <CardDescription>Choose how you hear about what matters. Security alerts are always sent by email.</CardDescription>\n        </CardHeader>\n        <CardContent className=\"flex flex-col gap-6\">\n          <div className=\"flex items-center justify-between gap-4 rounded-lg border p-4\">\n            <div className=\"flex items-start gap-3\">\n              <Bell className=\"mt-0.5 size-5 text-muted-foreground\" />\n              <div>\n                <Label htmlFor=\"pause\" className=\"font-medium\">Pause all notifications</Label>\n                <p className=\"text-sm text-muted-foreground\">Useful for holidays. You will still get security emails.</p>\n              </div>\n            </div>\n            <Switch id=\"pause\" checked={paused} onCheckedChange={(v) => { setPaused(v); setDirty(true) }} />\n          </div>\n\n          <div className={paused ? \"pointer-events-none opacity-50\" : undefined}>\n            <div className=\"grid grid-cols-[1fr_repeat(3,64px)] items-center gap-y-1 border-b pb-2 text-xs font-medium text-muted-foreground\">\n              <span />\n              {CHANNELS.map((c) => (\n                <span key={c.id} className=\"flex flex-col items-center gap-1\">\n                  <c.icon className=\"size-4\" /> {c.label}\n                </span>\n              ))}\n            </div>\n            {GROUPS.map((g) => (\n              <div key={g.title} className=\"border-b py-3 last:border-b-0\">\n                <h3 className=\"pb-2 text-sm font-semibold\">{g.title}</h3>\n                {g.items.map((item) => (\n                  <div key={item.id} className=\"grid grid-cols-[1fr_repeat(3,64px)] items-center py-2\">\n                    <div>\n                      <div className=\"text-sm font-medium\">{item.label}</div>\n                      <div className=\"text-xs text-muted-foreground\">{item.hint}</div>\n                    </div>\n                    {CHANNELS.map((c) => (\n                      <div key={c.id} className=\"flex justify-center\">\n                        <Checkbox aria-label={`${item.label} by ${c.label}`} checked={!!prefs[item.id]?.has(c.id)} onCheckedChange={(v) => toggle(item.id, c.id, !!v)} />\n                      </div>\n                    ))}\n                  </div>\n                ))}\n              </div>\n            ))}\n          </div>\n        </CardContent>\n        <CardFooter className=\"justify-end gap-2\">\n          <Button variant=\"ghost\" disabled={!dirty} onClick={() => { setPrefs(initial()); setPaused(false); setDirty(false) }}>Reset</Button>\n          <Button disabled={!dirty} onClick={() => setDirty(false)}>Save preferences</Button>\n        </CardFooter>\n      </Card>\n    </div>\n  )\n}\n",
      "type": "registry:component",
      "target": "components/goodui/notification-settings.tsx"
    }
  ],
  "categories": [
    "settings"
  ],
  "type": "registry:block"
}