{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "activity-feed-01",
  "description": "What people did across a workspace, newest first and grouped by day.",
  "registryDependencies": [
    "button",
    "card",
    "https://www.dashboardblocks.com/r/radix/activity-feed.json",
    "https://www.dashboardblocks.com/r/radix/block-state.json",
    "https://www.dashboardblocks.com/r/radix/tag.json",
    "https://www.dashboardblocks.com/r/radix/team.json"
  ],
  "files": [
    {
      "path": "registry/components/dashboardblocks/activity-feed/activity-feed-01.tsx",
      "content": "'use client'\n\nimport {\n  ActivityFeed,\n  ActivityFeedItem,\n  ActivityTime,\n  groupActivityByDay,\n} from '@/registry/components/dashboardblocks/activity-feed'\nimport {\n  BlockReady,\n  BlockStateProvider,\n  BlockStateRows,\n  type BlockStateProps,\n  getBlockState,\n} from '@/registry/components/dashboardblocks/block-state'\nimport { Tag } from '@/registry/components/dashboardblocks/tag'\nimport { type Person, PersonAvatar } from '@/registry/components/dashboardblocks/team'\nimport { IconPlaceholder } from '@/registry/icons/icon-placeholder'\nimport { useId } from 'react'\n\nimport { Button } from '@/components/ui/button'\nimport { Card, CardContent } from '@/components/ui/card'\n\ninterface Activity {\n  action: string\n  actor: Pick<Person, 'avatar' | 'name'>\n  at: Date\n  id: string\n  target?: string\n}\n\ninterface ActivityFeed1Props extends BlockStateProps {\n  /** Newest first. Leave out, or pass none, to show the empty state. */\n  activities?: Activity[]\n  /** Defaults to a sentence about how many updates and people the feed holds. */\n  description?: string\n  /** Pass a fixed date, so the block renders the same on the server and in the browser. */\n  now: Date\n  onViewAll?: () => void\n  title: string\n  timeZone?: string\n}\n\nconst NOW = new Date(Date.UTC(2026, 8, 26, 15, 0))\nconst minutesAgo = (minutes: number) => new Date(NOW.getTime() - minutes * 60_000)\n\nconst exampleProps: ActivityFeed1Props = {\n  activities: [\n    {\n      action: 'commented on',\n      actor: { avatar: '/images/avatar-02.webp', name: 'Priya Nair' },\n      at: minutesAgo(4),\n      id: 'a1',\n      target: 'Q4 pricing page',\n    },\n    {\n      action: 'invited',\n      actor: { name: 'Kenji Watanabe' },\n      at: minutesAgo(38),\n      id: 'a2',\n      target: 'mei@example.com',\n    },\n    {\n      action: 'moved Onboarding checklist to',\n      actor: { avatar: '/images/avatar-10.webp', name: 'Mei Tanaka' },\n      at: minutesAgo(190),\n      id: 'a3',\n      target: 'Done',\n    },\n    {\n      action: 'uploaded 3 files to',\n      actor: { name: 'Jonah Fischer' },\n      at: minutesAgo(60 * 20),\n      id: 'a4',\n      target: 'Brand assets',\n    },\n    {\n      action: 'created the project',\n      actor: { name: 'Amara Okafor' },\n      at: minutesAgo(60 * 23),\n      id: 'a5',\n      target: 'Mobile checkout',\n    },\n    {\n      action: 'closed 12 issues in',\n      actor: { avatar: '/images/avatar-13.webp', name: 'Lucas Silva' },\n      at: minutesAgo(60 * 50),\n      id: 'a6',\n      target: 'Sprint 24',\n    },\n  ],\n  now: NOW,\n  onViewAll: () => {},\n  title: 'Recent activity',\n}\n\nconst summarize = (activities: Activity[], days: number) => {\n  if (activities.length === 0) return 'Nothing has happened yet.'\n  const people = new Set(activities.map((activity) => activity.actor.name)).size\n  const updates = `${activities.length} ${activities.length === 1 ? 'update' : 'updates'}`\n  const from = `${people} ${people === 1 ? 'person' : 'people'}`\n  return `${updates} from ${from} over the last ${days === 1 ? 'day' : `${days} days`}.`\n}\n\nconst ActivityFeed1 = (props: ActivityFeed1Props) => {\n  const {\n    activities = [],\n    now,\n    onViewAll,\n    errorMessage,\n    status,\n    timeZone = 'UTC',\n    title,\n  } = props\n  const id = useId()\n  const days = groupActivityByDay(activities, now, timeZone)\n  const { description = summarize(activities, days.length) } = props\n  const state = getBlockState(status, activities)\n\n  return (\n    <BlockStateProvider errorMessage={errorMessage} state={state}>\n      <Card>\n        <CardContent>\n          <section className='@container flex flex-col gap-4'>\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                <BlockReady className='text-sm'>\n                  <p className='text-muted-foreground text-sm'>{description}</p>\n                </BlockReady>\n              </div>\n              {onViewAll && (\n                <Button variant='outline' size='sm' onClick={onViewAll}>\n                  View all\n                  <IconPlaceholder\n                    lucide='ArrowRightIcon'\n                    tabler='IconArrowRight'\n                    hugeicons='ArrowRight01Icon'\n                    phosphor='ArrowRightIcon'\n                    remixicon='RiArrowRightLine'\n                    data-icon='inline-end'\n                  />\n                </Button>\n              )}\n            </header>\n            {state && (\n              <div className='border-t'>\n                <BlockStateRows rows={6} />\n              </div>\n            )}\n            {!state &&\n              days.map((day) => (\n                <section\n                  key={day.key}\n                  aria-labelledby={`${id}-${day.key}`}\n                  className='flex flex-col gap-1 border-t pt-3'\n                >\n                  <h3\n                    id={`${id}-${day.key}`}\n                    className='text-muted-foreground flex items-center justify-between text-xs font-medium'\n                  >\n                    {day.label}\n                    <Tag>\n                      {day.items.length}\n                      <span className='sr-only'>\n                        {day.items.length === 1 ? ' update' : ' updates'}\n                      </span>\n                    </Tag>\n                  </h3>\n                  <ActivityFeed>\n                    {day.items.map((activity) => (\n                      <ActivityFeedItem key={activity.id} className='items-start py-2'>\n                        <PersonAvatar\n                          className='-my-0.5'\n                          person={activity.actor}\n                          size='sm'\n                        />\n                        <p className='min-w-0 flex-1 text-sm'>\n                          <span className='font-medium'>{activity.actor.name}</span>{' '}\n                          <span className='text-muted-foreground'>{activity.action}</span>\n                          {activity.target && (\n                            <>\n                              {' '}\n                              <span className='font-medium break-words'>\n                                {activity.target}\n                              </span>\n                            </>\n                          )}\n                        </p>\n                        <ActivityTime\n                          className='pt-0.5 tabular-nums'\n                          date={activity.at}\n                          now={now}\n                          timeZone={timeZone}\n                        />\n                      </ActivityFeedItem>\n                    ))}\n                  </ActivityFeed>\n                </section>\n              ))}\n          </section>\n        </CardContent>\n      </Card>\n    </BlockStateProvider>\n  )\n}\n\nexport {\n  ActivityFeed1,\n  exampleProps as activityFeed1ExampleProps,\n  type Activity,\n  type ActivityFeed1Props,\n}\n",
      "type": "registry:component",
      "target": "@components/dashboardblocks/activity-feed/activity-feed-01.tsx"
    }
  ],
  "meta": {
    "shows": "What people did across a workspace, newest first and grouped by day.",
    "size": "half",
    "usedWith": [
      "activity-feed-03",
      "team-01"
    ],
    "component": "ActivityFeed1",
    "props": "{ activities?: { action: string; actor: { avatar?: string; name: string }; at: Date; id: string; target?: string }[]; description?: string; now: Date; onViewAll?: () => void; title: string; timeZone?: string; errorMessage?: string; status?: \"loading\" | \"error\" }"
  },
  "type": "registry:component"
}
