{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "activity-feed-05",
  "description": "Slack and GitHub activity in one timeline, with quoted messages and actions such as starting a review.",
  "registryDependencies": [
    "card",
    "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/format.json",
    "https://www.dashboardblocks.com/r/radix/icon.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-05.tsx",
      "content": "'use client'\n\nimport {\n  ActivityFeed,\n  ActivityFeedItem,\n  ActivityTime,\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 { Icons } from '@/registry/components/dashboardblocks/icon'\nimport { Tag } from '@/registry/components/dashboardblocks/tag'\nimport { type Person, PersonAvatar } from '@/registry/components/dashboardblocks/team'\nimport { IconPlaceholder } from '@/registry/icons/icon-placeholder'\nimport { formatList, joinDetails } from '@/registry/lib/dashboardblocks/format'\n\nimport { Button } from '@/components/ui/button'\nimport { Card, CardContent } from '@/components/ui/card'\n\ntype Platform = 'slack' | 'github'\n\ninterface SocialMessage {\n  replies?: number\n  reactions?: number\n  tags?: string[]\n  text: string\n}\n\ninterface SocialEvent {\n  action?: string\n  author: Pick<Person, 'avatar' | 'name'>\n  at: Date\n  channel: string\n  description: string\n  id: string\n  message?: SocialMessage\n  platform: Platform\n}\n\ninterface ActivityFeed5Props extends BlockStateProps {\n  /** Defaults to a sentence about where the events came from and what waits on you. */\n  description?: string\n  /** Newest first. Leave out, or pass none, to show the empty state. */\n  events?: SocialEvent[]\n  /** Pass a fixed date, so the block renders the same on the server and in the browser. */\n  now: Date\n  onAction?: (event: SocialEvent) => void\n  onViewAll?: () => void\n  timeZone?: string\n  title: string\n}\n\nconst platformConfig: Record<\n  Platform,\n  { icon: (typeof Icons)[Platform]; label: string }\n> = {\n  github: { icon: Icons.github, label: 'GitHub' },\n  slack: { icon: Icons.slack, label: 'Slack' },\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: ActivityFeed5Props = {\n  events: [\n    {\n      at: minutesAgo(6),\n      author: { name: 'Wanda Kowalski' },\n      channel: '#welcome',\n      description: 'commented in',\n      id: 's1',\n      platform: 'slack',\n    },\n    {\n      action: 'Start review',\n      at: minutesAgo(19),\n      author: { avatar: '/images/avatar-10.webp', name: 'Tiffany Huang' },\n      channel: 'acme/dashboard',\n      description: 'opened pull request #278 in',\n      id: 's2',\n      platform: 'github',\n    },\n    {\n      at: minutesAgo(44),\n      author: { name: 'Neil Robertson' },\n      channel: '#showcase',\n      description: 'reacted 🔥 in',\n      id: 's3',\n      platform: 'slack',\n    },\n    {\n      at: minutesAgo(120),\n      author: { avatar: '/images/avatar-15.webp', name: 'Amelia Ortiz' },\n      channel: '#product-roadmap',\n      description: 'replied to a thread in',\n      id: 's4',\n      message: {\n        reactions: 2,\n        replies: 3,\n        tags: ['marketing', 'design'],\n        text: 'Just shipped the new onboarding flow! Would love feedback on the empty states before we roll it out to everyone.',\n      },\n      platform: 'slack',\n    },\n    {\n      at: minutesAgo(60 * 6),\n      author: { name: 'Tomasz Grzyb' },\n      channel: 'acme/dashboard',\n      description: 'published release v0.3.2 in',\n      id: 's5',\n      platform: 'github',\n    },\n  ],\n  now: NOW,\n  onViewAll: () => {},\n  title: 'Social activity',\n}\n\nconst plural = (count: number, one: string, many: string) =>\n  `${count} ${count === 1 ? one : many}`\n\nconst describeMessage = (message: SocialMessage) => [\n  ...(message.reactions ? [plural(message.reactions, 'reaction', 'reactions')] : []),\n  ...(message.replies ? [plural(message.replies, 'reply', 'replies')] : []),\n]\n\nconst summarize = (events: SocialEvent[]) => {\n  if (events.length === 0) return 'Nothing new from your tools.'\n  const sources = formatList(\n    (Object.keys(platformConfig) as Platform[])\n      .map((platform) => ({\n        count: events.filter((event) => event.platform === platform).length,\n        label: platformConfig[platform].label,\n      }))\n      .filter((source) => source.count > 0)\n      .map((source) => `${source.count} from ${source.label}`),\n  )\n  const waiting = events.filter((event) => event.action).length\n  return `${sources}${waiting > 0 ? `, ${waiting} waiting on you` : ''}.`\n}\n\nconst ActivityFeed5 = (props: ActivityFeed5Props) => {\n  const {\n    events = [],\n    now,\n    onAction,\n    onViewAll,\n    errorMessage,\n    status,\n    timeZone = 'UTC',\n    title,\n  } = props\n  const { description = summarize(events) } = props\n  const state = getBlockState(status, events)\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={5} />\n              </div>\n            )}\n            {!state && (\n              <ActivityFeed className='border-t pt-4'>\n                {events.map((event) => {\n                  const platform = platformConfig[event.platform]\n                  const PlatformIcon = platform.icon\n                  const details = event.message ? describeMessage(event.message) : []\n                  const tags = event.message?.tags ?? []\n                  return (\n                    <ActivityFeedItem key={event.id} className='pb-6 last:pb-0' connector>\n                      <span className='flex size-(--activity-marker) shrink-0 items-center justify-center'>\n                        <PersonAvatar\n                          className='ring-background ring-4'\n                          person={event.author}\n                        />\n                      </span>\n                      <div className='flex min-w-0 flex-1 flex-col gap-3 pt-1.5'>\n                        <div className='flex items-start justify-between gap-3'>\n                          <p className='text-sm'>\n                            <span className='font-medium'>{event.author.name}</span>{' '}\n                            <span className='text-muted-foreground'>\n                              {event.description}\n                            </span>{' '}\n                            <span className='font-medium break-words'>\n                              {event.channel}\n                            </span>\n                            <span className='sr-only'> on {platform.label}</span>\n                          </p>\n                          <span className='text-muted-foreground mt-0.5 flex shrink-0 items-center gap-1.5'>\n                            <PlatformIcon aria-hidden className='size-3.5' />\n                            <ActivityTime date={event.at} now={now} timeZone={timeZone} />\n                          </span>\n                        </div>\n                        {event.message && (\n                          <div className='flex flex-col gap-2 border-l-2 pl-3'>\n                            <p className='text-sm'>{event.message.text}</p>\n                            {(tags.length > 0 || details.length > 0) && (\n                              <div className='flex flex-wrap items-center gap-x-3 gap-y-1.5'>\n                                {tags.length > 0 && (\n                                  <ul aria-label='Tags' className='flex flex-wrap gap-1'>\n                                    {tags.map((tag) => (\n                                      <li key={tag}>\n                                        <Tag>#{tag}</Tag>\n                                      </li>\n                                    ))}\n                                  </ul>\n                                )}\n                                {details.length > 0 && (\n                                  <p className='text-muted-foreground text-xs tabular-nums'>\n                                    {joinDetails(...details)}\n                                  </p>\n                                )}\n                              </div>\n                            )}\n                          </div>\n                        )}\n                        {event.action && (\n                          <Button\n                            className='self-start'\n                            onClick={() => onAction?.(event)}\n                            size='sm'\n                            variant='outline'\n                          >\n                            {event.action}\n                          </Button>\n                        )}\n                      </div>\n                    </ActivityFeedItem>\n                  )\n                })}\n              </ActivityFeed>\n            )}\n          </section>\n        </CardContent>\n      </Card>\n    </BlockStateProvider>\n  )\n}\n\nexport {\n  ActivityFeed5,\n  exampleProps as activityFeed5ExampleProps,\n  type ActivityFeed5Props,\n  type Platform,\n  type SocialEvent,\n  type SocialMessage,\n}\n",
      "type": "registry:component",
      "target": "@components/dashboardblocks/activity-feed/activity-feed-05.tsx"
    }
  ],
  "meta": {
    "shows": "Slack and GitHub activity in one timeline, with quoted messages and actions such as starting a review.",
    "size": "half",
    "usedWith": [
      "activity-feed-01",
      "deployments-01"
    ],
    "component": "ActivityFeed5",
    "props": "{ description?: string; events?: { action?: string; author: { avatar?: string; name: string }; at: Date; channel: string; description: string; id: string; message?: { replies?: number; reactions?: number; tags?: string[]; text: string }; platform: \"slack\" | \"github\" }[]; now: Date; onAction?: (event: { action?: string; author: { avatar?: string; name: string }; at: Date; channel: string; description: string; id: string; message?: { replies?: number; reactions?: number; tags?: string[]; text: string }; platform: \"slack\" | \"github\" }) => void; onViewAll?: () => void; timeZone?: string; title: string; errorMessage?: string; status?: \"loading\" | \"error\" }"
  },
  "type": "registry:component"
}
