{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ecommerce-17",
  "type": "registry:block",
  "description": "Wishlist rows with price drops, stock status, move-to-bag, notify-me and remove actions.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "button"
  ],
  "files": [
    {
      "path": "registry/designali/blocks/ecommerce/ecommerce-17.tsx",
      "content": "\"use client\"\n\nimport { useState } from \"react\"\nimport {\n  Bell,\n  Heart,\n  ShoppingBag,\n  Trash2,\n} from \"@designali/icons\"\n\nimport { Button } from \"@workspace/ui/components/button\"\nimport { cn } from \"@workspace/ui/lib/utils\"\n\ntype Item = {\n  id: number\n  name: string\n  variant: string\n  price: number\n  was?: number\n  stock: \"in\" | \"low\" | \"out\"\n  added: string\n  image: string\n}\n\nconst initial: Item[] = [\n  { id: 1, name: \"Blocks Pro Bundle\", variant: \"Pro license · 460+ blocks\", price: 149, was: 199, stock: \"in\", added: \"Added 3 days ago\", image: \"/images/templates/aliimam-comp.jpg\" },\n  { id: 2, name: \"Design Agency Template\", variant: \"Studio license\", price: 179, stock: \"low\", added: \"Added 2 weeks ago\", image: \"/images/templates/design-agency.jpg\" },\n  { id: 3, name: \"Dalim Fonts Collection\", variant: \"Desktop + web\", price: 59, stock: \"out\", added: \"Added 1 month ago\", image: \"/images/templates/dalim-fonts-old.jpg\" },\n  { id: 4, name: \"Apple Device Mockups\", variant: \"iPhone, iPad, MacBook, iMac\", price: 35, stock: \"in\", added: \"Added 1 month ago\", image: \"/images/templates/aliimam-comp.jpg\" },\n]\n\nconst stockLabel = {\n  in: { text: \"In stock\", className: \"text-chart-3 dark:text-primary\" },\n  low: { text: \"Launch price ends soon\", className: \"text-chart-3 dark:text-primary\" },\n  out: { text: \"Coming soon\", className: \"text-muted-foreground\" },\n}\n\nexport default function Ecommerce17() {\n  const [items, setItems] = useState(initial)\n  const [moved, setMoved] = useState<number[]>([])\n  const [notify, setNotify] = useState<number[]>([])\n\n  const remove = (id: number) => setItems((l) => l.filter((i) => i.id !== id))\n  const value = items.reduce((s, i) => s + i.price, 0)\n  const drops = items.filter((i) => i.was).length\n\n  return (\n    <section className=\"w-full bg-background py-16 text-foreground md:py-24\">\n      <div className=\"mx-auto max-w-5xl px-6\">\n        <div className=\"flex flex-col justify-between gap-4 sm:flex-row sm:items-end\">\n          <div>\n            <h2 className=\"flex items-center gap-3 text-3xl font-medium tracking-tight\">\n              <Heart className=\"size-6\" />\n              Saved for later\n            </h2>\n            <p className=\"mt-1 text-sm text-muted-foreground\">\n              {items.length} items · ${value.toLocaleString()} total\n              {drops > 0 && <span> · {drops} price drop</span>}\n            </p>\n          </div>\n          <Button variant=\"outline\" disabled={items.length === 0} onClick={() => setMoved(items.filter((i) => i.stock !== \"out\").map((i) => i.id))}>\n            <ShoppingBag />\n            Move all available to bag\n          </Button>\n        </div>\n\n        <ul className=\"mt-8 border-t border-border\">\n          {items.length === 0 && (\n            <li className=\"py-20 text-center text-sm text-muted-foreground\">\n              Nothing saved yet. Tap the heart on any product to keep it here.\n            </li>\n          )}\n          {items.map((item) => {\n            const inBag = moved.includes(item.id)\n            const notified = notify.includes(item.id)\n            return (\n              <li key={item.id} className=\"grid grid-cols-[80px_1fr] gap-4 border-b border-border py-5 sm:grid-cols-[96px_1fr_auto] sm:items-center\">\n                <img src={item.image} alt={item.name} className={cn(\"aspect-square w-full border border-border object-cover object-top\", item.stock === \"out\" && \"opacity-50 grayscale\")} />\n                <div className=\"min-w-0\">\n                  <a href=\"#\" className=\"font-medium hover:underline\">{item.name}</a>\n                  <p className=\"text-xs text-muted-foreground\">{item.variant}</p>\n                  <p className=\"mt-2 flex flex-wrap items-baseline gap-x-2 text-sm tabular-nums\">\n                    <span className={cn(item.was && \"text-destructive dark:text-destructive\")}>${item.price}</span>\n                    {item.was && <span className=\"text-xs text-muted-foreground line-through\">${item.was}</span>}\n                    <span className={cn(\"text-xs\", stockLabel[item.stock].className)}>{stockLabel[item.stock].text}</span>\n                  </p>\n                  <p className=\"mt-1 text-[11px] text-muted-foreground\">{item.added}</p>\n                </div>\n                <div className=\"col-span-2 flex items-center gap-2 sm:col-span-1\">\n                  {item.stock === \"out\" ? (\n                    <Button\n                      variant=\"outline\"\n                      className=\"flex-1 sm:w-40 sm:flex-none\"\n                      onClick={() => setNotify((n) => (n.includes(item.id) ? n : [...n, item.id]))}\n                    >\n                      <Bell />\n                      {notified ? \"We'll email you\" : \"Notify me\"}\n                    </Button>\n                  ) : (\n                    <Button\n                      variant={inBag ? \"secondary\" : \"default\"}\n                      className=\"flex-1 sm:w-40 sm:flex-none\"\n                      onClick={() => setMoved((m) => (m.includes(item.id) ? m : [...m, item.id]))}\n                    >\n                      {inBag ? \"In your bag\" : \"Move to bag\"}\n                    </Button>\n                  )}\n                  <Button variant=\"ghost\" size=\"icon-lg\" aria-label={`Remove ${item.name}`} onClick={() => remove(item.id)}>\n                    <Trash2 />\n                  </Button>\n                </div>\n              </li>\n            )\n          })}\n        </ul>\n      </div>\n    </section>\n  )\n}\n",
      "type": "registry:component"
    }
  ],
  "meta": {
    "iframeHeight": "750px"
  },
  "categories": [
    "ecommerce"
  ]
}