{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "record-detail-02",
  "description": "An order page with line items and totals, a timeline of what happened, the customer, and shipping and payment.",
  "registryDependencies": [
    "button",
    "https://www.dashboardblocks.com/r/radix/activity-feed.json",
    "https://www.dashboardblocks.com/r/radix/block-state.json",
    "https://www.dashboardblocks.com/r/radix/details.json",
    "https://www.dashboardblocks.com/r/radix/format.json",
    "https://www.dashboardblocks.com/r/radix/page-header.json",
    "https://www.dashboardblocks.com/r/radix/record-detail.json",
    "https://www.dashboardblocks.com/r/radix/status-label.json",
    "https://www.dashboardblocks.com/r/radix/table.json"
  ],
  "files": [
    {
      "path": "registry/components/dashboardblocks/record-detail/record-detail-02.tsx",
      "content": "'use client'\n\nimport {\n  ActivityFeed,\n  ActivityFeedItem,\n  ActivityIcon,\n  ActivityTime,\n  type ActivityTone,\n} from '@/registry/components/dashboardblocks/activity-feed'\nimport {\n  BlockStateProvider,\n  BlockStateText,\n  type BlockStateProps,\n  SkeletonText,\n  getBlockState,\n} from '@/registry/components/dashboardblocks/block-state'\nimport { Details } from '@/registry/components/dashboardblocks/details'\nimport {\n  ActionsMenu,\n  BackLink,\n  PageHeader,\n  PageHeaderActions,\n  PageHeaderHeading,\n  PageHeaderRow,\n} from '@/registry/components/dashboardblocks/page-header'\nimport {\n  Property,\n  PropertyList,\n  RecordLayout,\n  RecordPlaceholder,\n  RecordSection,\n} from '@/registry/components/dashboardblocks/record-detail'\nimport {\n  StatusLabel,\n  type StatusTone,\n} from '@/registry/components/dashboardblocks/status-label'\nimport {\n  DataTable,\n  DataTableBody,\n  DataTableCell,\n  DataTableHead,\n  DataTableHeader,\n  DataTableRow,\n} from '@/registry/components/dashboardblocks/table'\nimport { IconPlaceholder } from '@/registry/icons/icon-placeholder'\nimport {\n  formatCurrency,\n  formatNumber,\n  formatPercent,\n} from '@/registry/lib/dashboardblocks/format'\nimport type { ReactNode } from 'react'\n\nimport { Button } from '@/components/ui/button'\n\ninterface LineItem {\n  name: string\n  price: number\n  quantity: number\n  sku: string\n}\n\ninterface OrderEvent {\n  at: Date\n  icon: ReactNode\n  text: string\n  tone: ActivityTone\n}\n\ntype Fulfilment = 'Delivered' | 'Shipped' | 'Unfulfilled'\ntype PaymentStatus = 'Paid' | 'Pending' | 'Refunded'\n\ninterface RecordDetail2Props extends BlockStateProps {\n  customer?: { email: string; href: string; name: string; orders: number }\n  events?: OrderEvent[]\n  items?: LineItem[]\n  /** Pass a fixed date, so times render the same on the server and in the browser. */\n  now: Date\n  onCancel?: () => void\n  onPrint?: () => void\n  onRefund?: () => void\n  /** Leave out to show the empty state. */\n  order?: {\n    fulfilment: Fulfilment\n    id: string\n    payment: string\n    placed: string\n    shipping: number\n    shippingAddress: string[]\n    status: PaymentStatus\n    taxRate: number\n  }\n}\n\nconst FULFILMENT_TONE: Record<Fulfilment, StatusTone> = {\n  Delivered: 'good',\n  Shipped: 'info',\n  Unfulfilled: 'warning',\n}\n\nconst PAYMENT_TONE: Record<PaymentStatus, StatusTone> = {\n  Paid: 'good',\n  Pending: 'warning',\n  Refunded: 'neutral',\n}\n\nconst money = (value: number) => formatCurrency(value, { precision: 'exact' })\n\nconst exampleNow = new Date(Date.UTC(2026, 8, 26, 12))\nconst hoursAgo = (hours: number) => new Date(exampleNow.getTime() - hours * 3_600_000)\n\nconst exampleProps: RecordDetail2Props = {\n  customer: {\n    email: 'jonas@northwind.io',\n    href: '#',\n    name: 'Jonas Weber',\n    orders: 12,\n  },\n  events: [\n    {\n      at: hoursAgo(3),\n      icon: (\n        <IconPlaceholder\n          lucide='TruckIcon'\n          tabler='IconTruck'\n          hugeicons='DeliveryTruck01Icon'\n          phosphor='TruckIcon'\n          remixicon='RiTruckLine'\n        />\n      ),\n      text: 'Shipped with DHL, tracking 00340434161094042557',\n      tone: 'info',\n    },\n    {\n      at: hoursAgo(26),\n      icon: (\n        <IconPlaceholder\n          lucide='PackageIcon'\n          tabler='IconPackage'\n          hugeicons='PackageIcon'\n          phosphor='PackageIcon'\n          remixicon='RiBox3Line'\n        />\n      ),\n      text: 'Packed by Lena Fischer',\n      tone: 'neutral',\n    },\n    {\n      at: hoursAgo(45),\n      icon: (\n        <IconPlaceholder\n          lucide='CreditCardIcon'\n          tabler='IconCreditCard'\n          hugeicons='CreditCardIcon'\n          phosphor='CreditCardIcon'\n          remixicon='RiBankCardLine'\n        />\n      ),\n      text: 'Payment of $652.22 captured',\n      tone: 'success',\n    },\n    {\n      at: hoursAgo(46),\n      icon: (\n        <IconPlaceholder\n          lucide='ShoppingCartIcon'\n          tabler='IconShoppingCart'\n          hugeicons='ShoppingCart01Icon'\n          phosphor='ShoppingCartIcon'\n          remixicon='RiShoppingCartLine'\n        />\n      ),\n      text: 'Order placed on the web store',\n      tone: 'neutral',\n    },\n  ],\n  items: [\n    { name: 'Oak desk organiser', price: 89, quantity: 2, sku: 'DSK-ORG-OAK' },\n    { name: 'Linen notebook, A5', price: 18.5, quantity: 6, sku: 'NB-LIN-A5' },\n    { name: 'Brass desk lamp', price: 249, quantity: 1, sku: 'LMP-BRS-01' },\n  ],\n  now: exampleNow,\n  order: {\n    fulfilment: 'Shipped',\n    id: '#1042',\n    payment: 'Visa ending 4242',\n    placed: 'Placed Sep 24, 2026 at 14:32',\n    shipping: 12,\n    shippingAddress: ['Jonas Weber', 'Torstraße 140', '10119 Berlin', 'Germany'],\n    status: 'Paid',\n    taxRate: 0.19,\n  },\n}\n\nconst RecordDetail2 = (props: RecordDetail2Props) => {\n  const {\n    customer,\n    events = [],\n    items = [],\n    now,\n    onCancel = () => {},\n    onPrint = () => {},\n    onRefund = () => {},\n    order,\n    errorMessage,\n    status,\n  } = props\n  const state = getBlockState(status, order)\n  const ready = order !== undefined && state === undefined\n  const taxRate = order?.taxRate ?? 0\n  const shipping = order?.shipping ?? 0\n  const subtotal = items.reduce((sum, item) => sum + item.price * item.quantity, 0)\n  const tax = subtotal * taxRate\n  const total = subtotal + shipping + tax\n  const units = items.reduce((sum, item) => sum + item.quantity, 0)\n  const totals = [\n    { label: 'Subtotal', value: subtotal },\n    { label: 'Shipping', value: shipping },\n    {\n      label: `Tax, ${formatPercent(taxRate, { maximumFractionDigits: 0 })}`,\n      value: tax,\n    },\n  ]\n\n  return (\n    <BlockStateProvider errorMessage={errorMessage} state={state}>\n      <div className='flex flex-col gap-8'>\n        <PageHeader>\n          <BackLink href='#'>Orders</BackLink>\n          <PageHeaderRow className='@2xl/page-header:items-end'>\n            {ready ? (\n              <PageHeaderHeading\n                title={`Order ${order.id}`}\n                description={order.placed}\n                badge={\n                  <Details className='text-muted-foreground text-sm'>\n                    <StatusLabel variant='text' tone={PAYMENT_TONE[order.status]}>\n                      {order.status}\n                    </StatusLabel>\n                    <StatusLabel variant='text' tone={FULFILMENT_TONE[order.fulfilment]}>\n                      {order.fulfilment}\n                    </StatusLabel>\n                  </Details>\n                }\n              />\n            ) : (\n              <PageHeaderHeading\n                title={<BlockStateText variant='short' />}\n                description={state === 'loading' && <SkeletonText className='w-48' />}\n              />\n            )}\n            <PageHeaderActions>\n              <Button variant='outline' disabled={!ready} onClick={onPrint}>\n                <IconPlaceholder\n                  lucide='PrinterIcon'\n                  tabler='IconPrinter'\n                  hugeicons='PrinterIcon'\n                  phosphor='PrinterIcon'\n                  remixicon='RiPrinterLine'\n                  data-icon='inline-start'\n                />\n                Print\n              </Button>\n              <Button variant='outline' disabled={!ready} onClick={onRefund}>\n                Refund\n              </Button>\n              <ActionsMenu\n                disabled={!ready}\n                items={[\n                  { label: 'Cancel order', onSelect: onCancel, variant: 'destructive' },\n                ]}\n              />\n            </PageHeaderActions>\n          </PageHeaderRow>\n        </PageHeader>\n        <RecordPlaceholder\n          aside={['Customer', 'Shipping and payment']}\n          sections={['Items', 'Timeline']}\n        />\n        {ready && (\n          <RecordLayout\n            aside={\n              <>\n                {customer && (\n                  <RecordSection title='Customer'>\n                    <p className='flex flex-col gap-0.5 text-sm'>\n                      <a\n                        href={customer.href}\n                        className='font-medium underline-offset-4 hover:underline'\n                      >\n                        {customer.name}\n                      </a>\n                      <span className='text-muted-foreground'>{customer.email}</span>\n                      <span className='text-muted-foreground'>\n                        {formatNumber(customer.orders)} orders\n                      </span>\n                    </p>\n                  </RecordSection>\n                )}\n                <RecordSection title='Shipping and payment'>\n                  <PropertyList>\n                    <Property label='Ship to'>\n                      <address className='not-italic'>\n                        {order.shippingAddress.map((line) => (\n                          <span key={line} className='block'>\n                            {line}\n                          </span>\n                        ))}\n                      </address>\n                    </Property>\n                    <Property label='Payment'>{order.payment}</Property>\n                  </PropertyList>\n                </RecordSection>\n              </>\n            }\n          >\n            <RecordSection\n              description={`${formatNumber(units)} items from ${items.length} products, ${money(total)} with shipping and tax.`}\n              title='Items'\n            >\n              <DataTable caption={`Items in order ${order.id}`}>\n                <DataTableHeader>\n                  <DataTableRow>\n                    <DataTableHead>Product</DataTableHead>\n                    <DataTableHead align='end'>Qty</DataTableHead>\n                    <DataTableHead align='end'>Price</DataTableHead>\n                    <DataTableHead align='end'>Total</DataTableHead>\n                  </DataTableRow>\n                </DataTableHeader>\n                <DataTableBody>\n                  {items.map((item) => (\n                    <DataTableRow key={item.sku}>\n                      <DataTableCell primary>\n                        <span className='block'>{item.name}</span>\n                        <span className='text-muted-foreground block font-mono text-xs font-normal'>\n                          {item.sku}\n                        </span>\n                      </DataTableCell>\n                      <DataTableCell align='end'>\n                        {formatNumber(item.quantity)}\n                      </DataTableCell>\n                      <DataTableCell align='end'>{money(item.price)}</DataTableCell>\n                      <DataTableCell align='end'>\n                        {money(item.price * item.quantity)}\n                      </DataTableCell>\n                    </DataTableRow>\n                  ))}\n                </DataTableBody>\n              </DataTable>\n              <dl className='ml-auto grid w-full max-w-xs grid-cols-[1fr_auto] gap-x-6 gap-y-1.5 border-t pt-3 text-sm tabular-nums'>\n                {totals.map((row) => (\n                  <div key={row.label} className='contents'>\n                    <dt className='text-muted-foreground'>{row.label}</dt>\n                    <dd className='text-right'>{money(row.value)}</dd>\n                  </div>\n                ))}\n                <div className='contents'>\n                  <dt className='pt-1.5 font-medium'>Total</dt>\n                  <dd className='pt-1.5 text-right text-2xl font-light tracking-tight'>\n                    {money(total)}\n                  </dd>\n                </div>\n              </dl>\n            </RecordSection>\n            <RecordSection title='Timeline'>\n              <ActivityFeed aria-label={`History of order ${order.id}`}>\n                {events.map((event) => (\n                  <ActivityFeedItem\n                    key={event.at.getTime()}\n                    className='pb-5 last:pb-0'\n                    connector\n                  >\n                    <ActivityIcon\n                      className='ring-background'\n                      icon={event.icon}\n                      tone={event.tone}\n                    />\n                    <div className='flex min-w-0 flex-1 flex-wrap items-baseline justify-between gap-x-3 pt-1.5'>\n                      <p className='text-sm'>{event.text}</p>\n                      <ActivityTime date={event.at} now={now} />\n                    </div>\n                  </ActivityFeedItem>\n                ))}\n              </ActivityFeed>\n            </RecordSection>\n          </RecordLayout>\n        )}\n      </div>\n    </BlockStateProvider>\n  )\n}\n\nexport {\n  RecordDetail2,\n  exampleProps as recordDetail2ExampleProps,\n  type RecordDetail2Props,\n}\n",
      "type": "registry:component",
      "target": "@components/dashboardblocks/record-detail/record-detail-02.tsx"
    }
  ],
  "meta": {
    "shows": "An order page with line items and totals, a timeline of what happened, the customer, and shipping and payment.",
    "size": "full",
    "usedWith": [
      "page-header-03",
      "invoice-01",
      "timeline-01"
    ],
    "component": "RecordDetail2",
    "props": "{ customer?: { email: string; href: string; name: string; orders: number }; events?: { at: Date; icon: ReactNode; text: string; tone: \"success\" | \"warning\" | \"danger\" | \"info\" | \"neutral\" | \"accent\" }[]; items?: { name: string; price: number; quantity: number; sku: string }[]; now: Date; onCancel?: () => void; onPrint?: () => void; onRefund?: () => void; order?: { fulfilment: \"Delivered\" | \"Shipped\" | \"Unfulfilled\"; id: string; payment: string; placed: string; shipping: number; shippingAddress: string[]; status: \"Paid\" | \"Pending\" | \"Refunded\"; taxRate: number }; errorMessage?: string; status?: \"loading\" | \"error\" }"
  },
  "type": "registry:component"
}
