{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "record-detail-01",
  "description": "A customer page with headline numbers, recent orders, contact details and notes.",
  "registryDependencies": [
    "button",
    "https://www.dashboardblocks.com/r/radix/block-state.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",
    "https://www.dashboardblocks.com/r/radix/tag.json",
    "https://www.dashboardblocks.com/r/radix/team.json"
  ],
  "files": [
    {
      "path": "registry/components/dashboardblocks/record-detail/record-detail-01.tsx",
      "content": "'use client'\n\nimport {\n  BlockStateProvider,\n  BlockStateText,\n  type BlockStateProps,\n  SkeletonText,\n  getBlockState,\n} from '@/registry/components/dashboardblocks/block-state'\nimport {\n  ActionsMenu,\n  BackLink,\n  PageHeader,\n  PageHeaderActions,\n  type PageHeaderFact,\n  PageHeaderFacts,\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  DataTableRowLink,\n} from '@/registry/components/dashboardblocks/table'\nimport { Tag } from '@/registry/components/dashboardblocks/tag'\nimport { PersonAvatar } from '@/registry/components/dashboardblocks/team'\nimport { IconPlaceholder } from '@/registry/icons/icon-placeholder'\nimport { formatCurrency, joinDetails } from '@/registry/lib/dashboardblocks/format'\n\nimport { Button } from '@/components/ui/button'\n\ntype OrderStatus = 'Delivered' | 'Refunded' | 'Shipped'\n\ninterface CustomerOrder {\n  date: string\n  href: string\n  id: string\n  status: OrderStatus\n  total: number\n}\n\ninterface RecordDetail1Props extends BlockStateProps {\n  /** Leave out to show the empty state. */\n  customer?: {\n    avatar?: string\n    email: string\n    location: string\n    name: string\n    notes: string\n    phone: string\n    since: string\n    status: 'Active' | 'At risk' | 'Churned'\n    tags: string[]\n  }\n  onDelete?: () => void\n  onEdit?: () => void\n  onMerge?: () => void\n  orders?: CustomerOrder[]\n  stats?: PageHeaderFact[]\n}\n\nconst exampleProps: RecordDetail1Props = {\n  customer: {\n    avatar: '/images/avatar-07.webp',\n    email: 'jonas@northwind.io',\n    location: 'Berlin, Germany',\n    name: 'Jonas Weber',\n    notes: 'Prefers invoices at the end of the month. Wholesale pricing agreed in May.',\n    phone: '+49 30 901820',\n    since: 'Mar 14, 2024',\n    status: 'Active',\n    tags: ['Wholesale', 'EU'],\n  },\n  orders: [\n    { date: 'Sep 24, 2026', href: '#', id: '#1042', status: 'Shipped', total: 652.22 },\n    { date: 'Aug 30, 2026', href: '#', id: '#0987', status: 'Delivered', total: 289 },\n    { date: 'Aug 2, 2026', href: '#', id: '#0931', status: 'Refunded', total: 94.5 },\n    { date: 'Jul 11, 2026', href: '#', id: '#0874', status: 'Delivered', total: 1_210 },\n  ],\n  stats: [\n    { detail: 'Top 5% of customers', label: 'Lifetime value', value: '$4,820' },\n    { detail: 'Since Mar 2024', label: 'Orders', value: '12' },\n    { label: 'Average order', value: '$401.67' },\n    { detail: 'Order #1042', label: 'Last order', value: '3 days ago' },\n  ],\n}\n\ntype CustomerStatus = NonNullable<RecordDetail1Props['customer']>['status']\n\nconst CUSTOMER_TONE: Record<CustomerStatus, StatusTone> = {\n  Active: 'good',\n  'At risk': 'warning',\n  Churned: 'neutral',\n}\n\nconst ORDER_TONE: Record<OrderStatus, StatusTone> = {\n  Delivered: 'good',\n  Refunded: 'neutral',\n  Shipped: 'info',\n}\n\nconst money = (value: number) => formatCurrency(value, { precision: 'exact' })\n\nconst RecordDetail1 = (props: RecordDetail1Props) => {\n  const {\n    customer,\n    onDelete = () => {},\n    onEdit = () => {},\n    onMerge = () => {},\n    orders = [],\n    stats = [],\n    errorMessage,\n    status,\n  } = props\n  const state = getBlockState(status, customer)\n  const ready = customer !== undefined && state === undefined\n  const spent = orders\n    .filter((order) => order.status !== 'Refunded')\n    .reduce((sum, order) => sum + order.total, 0)\n\n  return (\n    <BlockStateProvider errorMessage={errorMessage} state={state}>\n      <div className='flex flex-col gap-8'>\n        <PageHeader>\n          <BackLink href='#'>Customers</BackLink>\n          <PageHeaderRow className='@2xl/page-header:items-end'>\n            {ready ? (\n              <PageHeaderHeading\n                title={customer.name}\n                description={joinDetails(customer.email, customer.location)}\n                badge={\n                  <StatusLabel tone={CUSTOMER_TONE[customer.status]}>\n                    {customer.status}\n                  </StatusLabel>\n                }\n                media={<PersonAvatar className='size-12' person={customer} size='lg' />}\n              />\n            ) : (\n              <PageHeaderHeading\n                title={<BlockStateText variant='short' />}\n                description={state === 'loading' && <SkeletonText className='w-56' />}\n              />\n            )}\n            <PageHeaderActions>\n              <Button variant='outline' disabled={!ready} onClick={onEdit}>\n                <IconPlaceholder\n                  lucide='PencilIcon'\n                  tabler='IconPencil'\n                  hugeicons='PencilEdit02Icon'\n                  phosphor='PencilSimpleIcon'\n                  remixicon='RiPencilLine'\n                  data-icon='inline-start'\n                />\n                Edit\n              </Button>\n              <ActionsMenu\n                disabled={!ready}\n                items={[\n                  { label: 'Merge customer', onSelect: onMerge },\n                  {\n                    label: 'Delete customer',\n                    onSelect: onDelete,\n                    variant: 'destructive',\n                  },\n                ]}\n              />\n            </PageHeaderActions>\n          </PageHeaderRow>\n          {ready && <PageHeaderFacts items={stats} />}\n          {state === 'loading' && stats.length > 0 && (\n            <PageHeaderFacts\n              items={stats.map((fact) => ({\n                label: fact.label,\n                value: <SkeletonText className='w-16' />,\n              }))}\n            />\n          )}\n        </PageHeader>\n        <RecordPlaceholder aside={['Details', 'Notes']} sections={['Recent orders']} />\n        {ready && (\n          <RecordLayout\n            aside={\n              <>\n                <RecordSection title='Details'>\n                  <PropertyList>\n                    <Property label='Email'>\n                      <a\n                        href={`mailto:${customer.email}`}\n                        className='underline-offset-4 hover:underline'\n                      >\n                        {customer.email}\n                      </a>\n                    </Property>\n                    <Property label='Phone'>{customer.phone}</Property>\n                    <Property label='Location'>{customer.location}</Property>\n                    <Property label='Customer since'>{customer.since}</Property>\n                    <Property label='Tags'>\n                      <span className='flex flex-wrap gap-1'>\n                        {customer.tags.map((tag) => (\n                          <Tag key={tag}>{tag}</Tag>\n                        ))}\n                      </span>\n                    </Property>\n                  </PropertyList>\n                </RecordSection>\n                <RecordSection title='Notes'>\n                  <p className='text-muted-foreground text-sm'>{customer.notes}</p>\n                </RecordSection>\n              </>\n            }\n          >\n            <RecordSection\n              description={`The last ${orders.length} orders, ${money(spent)} after refunds.`}\n              title='Recent orders'\n            >\n              <DataTable caption='Recent orders'>\n                <DataTableHeader>\n                  <DataTableRow>\n                    <DataTableHead>Order</DataTableHead>\n                    <DataTableHead>Date</DataTableHead>\n                    <DataTableHead>Status</DataTableHead>\n                    <DataTableHead align='end'>Total</DataTableHead>\n                  </DataTableRow>\n                </DataTableHeader>\n                <DataTableBody>\n                  {orders.map((order) => (\n                    <DataTableRow key={order.id}>\n                      <DataTableCell primary>\n                        <DataTableRowLink href={order.href}>{order.id}</DataTableRowLink>\n                      </DataTableCell>\n                      <DataTableCell className='text-muted-foreground whitespace-nowrap'>\n                        {order.date}\n                      </DataTableCell>\n                      <DataTableCell>\n                        <StatusLabel tone={ORDER_TONE[order.status]}>\n                          {order.status}\n                        </StatusLabel>\n                      </DataTableCell>\n                      <DataTableCell align='end'>{money(order.total)}</DataTableCell>\n                    </DataTableRow>\n                  ))}\n                </DataTableBody>\n              </DataTable>\n            </RecordSection>\n          </RecordLayout>\n        )}\n      </div>\n    </BlockStateProvider>\n  )\n}\n\nexport {\n  RecordDetail1,\n  exampleProps as recordDetail1ExampleProps,\n  type RecordDetail1Props,\n}\n",
      "type": "registry:component",
      "target": "@components/dashboardblocks/record-detail/record-detail-01.tsx"
    }
  ],
  "meta": {
    "shows": "A customer page with headline numbers, recent orders, contact details and notes.",
    "size": "full",
    "usedWith": [
      "page-header-03",
      "data-table-02",
      "comments-01"
    ],
    "component": "RecordDetail1",
    "props": "{ customer?: { avatar?: string; email: string; location: string; name: string; notes: string; phone: string; since: string; status: \"Active\" | \"At risk\" | \"Churned\"; tags: string[] }; onDelete?: () => void; onEdit?: () => void; onMerge?: () => void; orders?: { date: string; href: string; id: string; status: \"Refunded\" | \"Delivered\" | \"Shipped\"; total: number }[]; stats?: { detail?: ReactNode; label: string; value: ReactNode }[]; errorMessage?: string; status?: \"loading\" | \"error\" }"
  },
  "type": "registry:component"
}
