{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ecommerce-20",
  "type": "registry:block",
  "description": "Account order history with status filter tabs and expandable orders showing items, invoice and buy-again actions.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "button"
  ],
  "files": [
    {
      "path": "registry/designali/blocks/ecommerce/ecommerce-20.tsx",
      "content": "\"use client\"\n\nimport { useState } from \"react\"\nimport {\n  ChevronDown,\n  Download,\n  RotateCcw,\n} from \"@designali/icons\"\n\nimport { Button } from \"@workspace/ui/components/button\"\nimport { cn } from \"@workspace/ui/lib/utils\"\n\ntype Status = \"Processing\" | \"Shipped\" | \"Delivered\" | \"Returned\"\n\nconst orders: {\n  id: string\n  date: string\n  status: Status\n  total: number\n  items: { name: string; qty: number; price: number; image: string }[]\n}[] = [\n  {\n    id: \"DA-30418\",\n    date: \"12 Nov 2026\",\n    status: \"Processing\",\n    total: 86,\n    items: [\n      { name: \"Portfolio Simple Template\", qty: 1, price: 24, image: \"/images/templates/portfolio-simple.jpg\" },\n      { name: \"Dalim UI Kit\", qty: 2, price: 31, image: \"/images/templates/dalim-ui-old.jpg\" },\n    ],\n  },\n  {\n    id: \"DA-29877\",\n    date: \"28 Oct 2026\",\n    status: \"Shipped\",\n    total: 142,\n    items: [\n      { name: \"Designali Icons Pro\", qty: 2, price: 36, image: \"/images/templates/dalim-icons-old.jpg\" },\n      { name: \"Apple Device Mockups\", qty: 2, price: 35, image: \"/images/templates/aliimam-comp.jpg\" },\n    ],\n  },\n  {\n    id: \"DA-28102\",\n    date: \"3 Sep 2026\",\n    status: \"Delivered\",\n    total: 58,\n    items: [\n      { name: \"Designali Logos Pack\", qty: 2, price: 29, image: \"/images/templates/dalim-graphic-old.jpg\" },\n    ],\n  },\n  {\n    id: \"DA-27650\",\n    date: \"19 Aug 2026\",\n    status: \"Returned\",\n    total: 44,\n    items: [\n      { name: \"Vectors Starter Pack\", qty: 4, price: 11, image: \"/images/templates/dalim-visuals-old.jpg\" },\n    ],\n  },\n]\n\nconst statusStyle: Record<Status, string> = {\n  Processing: \"bg-primary/15 text-chart-4 dark:text-chart-1\",\n  Shipped: \"bg-primary/15 text-chart-4 dark:text-chart-1\",\n  Delivered: \"bg-primary/15 text-chart-4 dark:text-chart-1\",\n  Returned: \"bg-muted text-muted-foreground\",\n}\n\nconst filters = [\"All\", \"Processing\", \"Shipped\", \"Delivered\", \"Returned\"] as const\n\nexport default function Ecommerce20() {\n  const [filter, setFilter] = useState<(typeof filters)[number]>(\"All\")\n  const [expanded, setExpanded] = useState<string | null>(orders[0]!.id)\n  const [reordered, setReordered] = useState<string[]>([])\n  const visible = filter === \"All\" ? orders : orders.filter((o) => o.status === filter)\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 gap-1\">\n          <p className=\"text-sm text-muted-foreground\">Account · designali.com</p>\n          <h2 className=\"text-3xl font-medium tracking-tight\">Your orders</h2>\n        </div>\n\n        <div className=\"mt-6 flex gap-1 overflow-x-auto border-b border-border [scrollbar-width:none]\">\n          {filters.map((f) => {\n            const count = f === \"All\" ? orders.length : orders.filter((o) => o.status === f).length\n            return (\n              <button\n                key={f}\n                type=\"button\"\n                onClick={() => setFilter(f)}\n                className={cn(\n                  \"-mb-px shrink-0 border-b-2 px-3 py-2.5 text-sm transition-colors\",\n                  filter === f ? \"border-foreground text-foreground\" : \"border-transparent text-muted-foreground hover:text-foreground\"\n                )}\n              >\n                {f} <span className=\"text-xs text-muted-foreground\">{count}</span>\n              </button>\n            )\n          })}\n        </div>\n\n        <ul className=\"mt-6 space-y-3\">\n          {visible.map((order) => {\n            const isOpen = expanded === order.id\n            const done = reordered.includes(order.id)\n            return (\n              <li key={order.id} className=\"border border-border\">\n                <button\n                  type=\"button\"\n                  aria-expanded={isOpen}\n                  onClick={() => setExpanded(isOpen ? null : order.id)}\n                  className=\"grid w-full grid-cols-[1fr_auto] items-center gap-x-4 gap-y-2 p-4 text-left transition-colors hover:bg-muted/40 sm:grid-cols-[1fr_1fr_1fr_auto_auto] sm:p-5\"\n                >\n                  <span>\n                    <span className=\"block font-sans text-sm font-medium\">#{order.id}</span>\n                    <span className=\"block text-xs text-muted-foreground sm:hidden\">{order.date}</span>\n                  </span>\n                  <span className=\"hidden text-sm text-muted-foreground sm:block\">{order.date}</span>\n                  <span className=\"hidden text-sm tabular-nums sm:block\">${order.total.toFixed(2)}</span>\n                  <span className={cn(\"w-fit px-2 py-0.5 text-xs\", statusStyle[order.status])}>{order.status}</span>\n                  <ChevronDown\n                    className={cn(\"hidden size-4 text-muted-foreground transition-transform sm:block\", isOpen && \"rotate-180\")}\n                  />\n                </button>\n\n                {isOpen && (\n                  <div className=\"border-t border-border p-4 sm:p-5\">\n                    <ul className=\"space-y-3\">\n                      {order.items.map((item) => (\n                        <li key={item.name} className=\"flex items-center gap-3 text-sm\">\n                          <img src={item.image} alt={item.name} className=\"size-12 shrink-0 object-cover object-top border border-border\" />\n                          <span className=\"min-w-0 flex-1\">\n                            <span className=\"block truncate\">{item.name}</span>\n                            <span className=\"block text-xs text-muted-foreground\">Qty {item.qty}</span>\n                          </span>\n                          <span className=\"tabular-nums\">${item.price.toFixed(2)}</span>\n                        </li>\n                      ))}\n                    </ul>\n                    <div className=\"mt-5 flex flex-wrap items-center justify-between gap-3 border-t border-border pt-4\">\n                      <span className=\"text-sm\">\n                        Total <span className=\"font-medium tabular-nums\">${order.total.toFixed(2)}</span>\n                      </span>\n                      <div className=\"flex flex-wrap gap-2\">\n                        <Button variant=\"ghost\" size=\"md\">\n                          <Download />\n                          Invoice\n                        </Button>\n                        {order.status === \"Delivered\" && (\n                          <Button variant=\"outline\" size=\"md\">\n                            Request a refund\n                          </Button>\n                        )}\n                        <Button\n                          size=\"md\"\n                          variant={done ? \"secondary\" : \"default\"}\n                          onClick={() => setReordered((r) => (r.includes(order.id) ? r : [...r, order.id]))}\n                        >\n                          <RotateCcw />\n                          {done ? \"Added to bag\" : \"Buy again\"}\n                        </Button>\n                      </div>\n                    </div>\n                  </div>\n                )}\n              </li>\n            )\n          })}\n        </ul>\n      </div>\n    </section>\n  )\n}\n",
      "type": "registry:component"
    }
  ],
  "meta": {
    "iframeHeight": "800px"
  },
  "categories": [
    "ecommerce"
  ]
}