{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "team-01",
  "description": "A list of members with their role, whether they are online and when they were last active.",
  "registryDependencies": [
    "card",
    "button",
    "https://www.dashboardblocks.com/r/radix/block-state.json",
    "https://www.dashboardblocks.com/r/radix/team.json",
    "https://www.dashboardblocks.com/r/radix/format.json"
  ],
  "files": [
    {
      "path": "registry/components/dashboardblocks/team/team-01.tsx",
      "content": "'use client'\n\nimport {\n  BlockReady,\n  BlockStateProvider,\n  BlockStateRows,\n  type BlockStateProps,\n  getBlockState,\n} from '@/registry/components/dashboardblocks/block-state'\nimport {\n  type Person,\n  PersonAvatar,\n  PresenceLabel,\n} from '@/registry/components/dashboardblocks/team'\nimport { IconPlaceholder } from '@/registry/icons/icon-placeholder'\nimport { formatRelativeTime } from '@/registry/lib/dashboardblocks/format'\n\nimport { Button } from '@/components/ui/button'\nimport { Card, CardContent } from '@/components/ui/card'\n\ninterface Member extends Person {\n  lastActive?: Date\n  role: string\n}\n\ninterface Team1Props extends BlockStateProps {\n  /** @default a sentence counting who's online and away */\n  description?: string\n  /** Leave out, or pass none, to show the empty state. */\n  members?: Member[]\n  now: Date\n  onInvite?: () => void\n  title: string\n}\n\nconst NOW = Date.UTC(2026, 8, 25, 14, 30)\nconst minutesAgo = (minutes: number) => new Date(NOW - minutes * 60_000)\n\nconst exampleProps: Team1Props = {\n  members: [\n    {\n      avatar: '/images/avatar-05.webp',\n      id: 'm1',\n      name: 'Amara Okafor',\n      presence: 'online',\n      role: 'Engineering manager',\n    },\n    {\n      avatar: '/images/avatar-04.webp',\n      id: 'm2',\n      name: 'Liam Carter',\n      presence: 'online',\n      role: 'Staff engineer',\n    },\n    {\n      avatar: '/images/avatar-01.webp',\n      id: 'm3',\n      lastActive: minutesAgo(12),\n      name: 'Sofia Rossi',\n      presence: 'away',\n      role: 'Product designer',\n    },\n    {\n      avatar: '/images/avatar-06.webp',\n      id: 'm4',\n      name: 'Mateo García',\n      presence: 'online',\n      role: 'Frontend engineer',\n    },\n    {\n      avatar: '/images/avatar-02.webp',\n      id: 'm5',\n      lastActive: minutesAgo(38),\n      name: 'Priya Nair',\n      presence: 'away',\n      role: 'Data analyst',\n    },\n    {\n      avatar: '/images/avatar-07.webp',\n      id: 'm6',\n      lastActive: minutesAgo(60 * 5 + 10),\n      name: 'Jonas Weber',\n      presence: 'offline',\n      role: 'Backend engineer',\n    },\n    {\n      id: 'm7',\n      lastActive: minutesAgo(60 * 26),\n      name: 'Hana Kobayashi',\n      presence: 'offline',\n      role: 'QA engineer',\n    },\n  ],\n  now: new Date(NOW),\n  title: 'Team members',\n}\n\nfunction summarize(members: Member[]) {\n  const online = members.filter((member) => member.presence === 'online').length\n  const away = members.filter((member) => member.presence === 'away').length\n  const people = `${members.length} ${members.length === 1 ? 'person' : 'people'}`\n  if (online === 0) return `${people}, nobody online right now.`\n  return `${people}, ${online} online now${away > 0 ? ` and ${away} away` : ''}.`\n}\n\nconst Team1 = (props: Team1Props) => {\n  const { description, members = [], now, onInvite, errorMessage, status, title } = props\n  const state = getBlockState(status, members)\n\n  return (\n    <BlockStateProvider errorMessage={errorMessage} state={state}>\n      <Card>\n        <CardContent>\n          <section className='@container flex flex-col gap-3'>\n            <header className='flex items-start justify-between gap-3'>\n              <div className='flex min-w-0 flex-col gap-0.5'>\n                <h2 className='font-semibold tracking-tight'>{title}</h2>\n                {description ? (\n                  <p className='text-muted-foreground text-sm'>{description}</p>\n                ) : (\n                  <BlockReady className='text-sm'>\n                    <p className='text-muted-foreground text-sm'>{summarize(members)}</p>\n                  </BlockReady>\n                )}\n              </div>\n              <Button variant='outline' size='sm' onClick={onInvite}>\n                <IconPlaceholder\n                  lucide='UserPlusIcon'\n                  tabler='IconUserPlus'\n                  hugeicons='UserAdd01Icon'\n                  phosphor='UserPlusIcon'\n                  remixicon='RiUserAddLine'\n                  data-icon='inline-start'\n                />\n                Invite\n              </Button>\n            </header>\n            <BlockStateRows className='border-t' rows={members.length || 5} />\n            {!state && (\n              <ul className='flex flex-col divide-y border-t'>\n                {members.map((member) => {\n                  const presence = member.presence ?? 'offline'\n                  return (\n                    <li key={member.id} className='flex items-center gap-3 py-2.5'>\n                      <PersonAvatar person={member} showPresence />\n                      <div className='flex min-w-0 flex-1 flex-col'>\n                        <span className='truncate text-sm font-medium'>\n                          {member.name}\n                        </span>\n                        <span className='text-muted-foreground truncate text-xs'>\n                          {member.role}\n                        </span>\n                      </div>\n                      <span className='flex shrink-0 flex-col items-end text-xs'>\n                        <PresenceLabel presence={presence} className='text-xs' />\n                        {presence !== 'online' && member.lastActive && (\n                          <time\n                            className='text-muted-foreground tabular-nums'\n                            dateTime={member.lastActive.toISOString()}\n                          >\n                            {formatRelativeTime(member.lastActive, now)}\n                          </time>\n                        )}\n                      </span>\n                    </li>\n                  )\n                })}\n              </ul>\n            )}\n          </section>\n        </CardContent>\n      </Card>\n    </BlockStateProvider>\n  )\n}\n\nexport { Team1, exampleProps as team1ExampleProps, type Team1Props }\n",
      "type": "registry:component",
      "target": "@components/dashboardblocks/team/team-01.tsx"
    }
  ],
  "meta": {
    "shows": "A list of members with their role, whether they are online and when they were last active.",
    "size": "half",
    "usedWith": [
      "team-05",
      "team-06",
      "settings-01"
    ],
    "component": "Team1",
    "props": "{ description?: string; members?: { lastActive?: Date; role: string; avatar?: string; id: string; name: string; presence?: \"online\" | \"away\" | \"offline\" }[]; now: Date; onInvite?: () => void; title: string; errorMessage?: string; status?: \"loading\" | \"error\" }"
  },
  "type": "registry:component"
}
