{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "timeline-07",
  "title": "Comment timeline",
  "description": "Avatars on the line and each comment in a soft bubble with its time.",
  "dependencies": [
    "date-fns"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/avatar.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/timeline.json",
    "https://ui.ndekocode.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/components/timeline/timeline-07.tsx",
      "content": "import { Avatar } from '@/registry/ndeko/ui/avatar';\nimport {\n  Timeline,\n  TimelineContent,\n  TimelineHeader,\n  TimelineIndicator,\n  TimelineItem,\n  TimelineSeparator,\n  TimelineTitle,\n} from '@/registry/ndeko/ui/timeline';\n\nimport { AgoTime } from './_parts/ago-time';\nimport { MARKER, MARKER_RAIL, MARKER_ROW } from './_parts/markers';\n\ntype Remark = {\n  author: string;\n  action: string;\n  text: string;\n  at: string;\n};\n\nconst REVIEW_THREAD: Remark[] = [\n  {\n    author: 'Noor Rahimi',\n    action: 'shared round two',\n    text: 'Three label options for the cocoa tin. Option B keeps the oat stalk from the old pack.',\n    at: '2026-11-12T11:55:00',\n  },\n  {\n    author: 'Tobias Lindqvist',\n    action: 'left a note',\n    text: 'B reads best from the shelf. The weight line gets hard to read under 40 mm though.',\n    at: '2026-11-12T13:10:00',\n  },\n  {\n    author: 'Wanjiru Kamau',\n    action: 'asked you to check it',\n    text: 'Can you look at the clear zone around the barcode before Thursday?',\n    at: '2026-11-12T14:15:00',\n  },\n  {\n    author: 'Idris Okoye',\n    action: 'approved option B',\n    text: 'Approved with the larger weight line. It goes to the printer tonight.',\n    at: '2026-11-12T14:50:00',\n  },\n];\n\nconst ROW = [\n  MARKER_ROW,\n  'group-data-[orientation=vertical]/timeline:not-last:pb-8',\n].join(' ');\n\nconst PORTRAIT_FRAME = [MARKER, 'border-none bg-transparent'].join(' ');\n\nexport default function Timeline07() {\n  return (\n    <Timeline\n      role='list'\n      aria-label='Review of the Oatfield label'\n      className='w-full max-w-md [--marker:1.5rem]'\n    >\n      {REVIEW_THREAD.map((remark, index) => {\n        const step = index + 1;\n\n        return (\n          <TimelineItem\n            key={remark.at}\n            step={step}\n            role='listitem'\n            className={ROW}\n          >\n            <TimelineHeader>\n              <TimelineIndicator className={PORTRAIT_FRAME}>\n                <Avatar seed={remark.author} className='size-(--marker)' />\n              </TimelineIndicator>\n              <TimelineSeparator className={MARKER_RAIL} />\n              <TimelineTitle className='mt-0.5'>\n                {remark.author}{' '}\n                <span className='text-muted-foreground font-normal'>\n                  {remark.action}\n                </span>\n              </TimelineTitle>\n            </TimelineHeader>\n            <TimelineContent className='bg-foreground/[0.04] text-foreground mt-2 rounded-xl px-3 py-2.5'>\n              {remark.text}\n              <AgoTime at={remark.at} className='mt-1' />\n            </TimelineContent>\n          </TimelineItem>\n        );\n      })}\n    </Timeline>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/timeline/timeline-07.tsx"
    },
    {
      "path": "registry/ndeko/components/timeline/_parts/ago-time.tsx",
      "content": "import { cn } from '@/registry/ndeko/lib/utils';\nimport { TimelineDate } from '@/registry/ndeko/ui/timeline';\n\nimport { agoLabelOf, stampLabelOf } from './dates';\n\ntype AgoTimeProps = {\n  at: string;\n  className?: string;\n};\n\nexport function AgoTime({ at, className }: AgoTimeProps) {\n  return (\n    <TimelineDate\n      dateTime={at}\n      title={stampLabelOf(at)}\n      className={cn('mb-0', className)}\n    >\n      {agoLabelOf(at)}\n    </TimelineDate>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/timeline/_parts/ago-time.tsx"
    },
    {
      "path": "registry/ndeko/components/timeline/_parts/dates.ts",
      "content": "import { differenceInMinutes, format, parseISO } from 'date-fns';\n\n/* Every time is read against one fixed moment and written without a time zone, so the server and the browser print the same labels. */\nconst NOW = '2026-11-12T15:00:00';\n\nconst MINUTES_PER_HOUR = 60;\n\nconst MINUTES_PER_DAY = 1440;\n\nexport function dayLabelOf(isoDay: string) {\n  const day = parseISO(isoDay);\n  return format(day, 'MMM d, yyyy');\n}\n\nexport function stampLabelOf(isoTime: string) {\n  const time = parseISO(isoTime);\n  return format(time, \"MMMM d, yyyy 'at' HH:mm\");\n}\n\nfunction agoOf(count: number, unit: string) {\n  if (count === 1) {\n    return `1 ${unit} ago`;\n  }\n  return `${count} ${unit}s ago`;\n}\n\nexport function agoLabelOf(isoTime: string) {\n  const now = parseISO(NOW);\n  const time = parseISO(isoTime);\n  const minutes = differenceInMinutes(now, time);\n  if (minutes < 1) {\n    return 'Just now';\n  }\n  if (minutes < MINUTES_PER_HOUR) {\n    return agoOf(minutes, 'minute');\n  }\n  if (minutes < MINUTES_PER_DAY) {\n    const hours = Math.floor(minutes / MINUTES_PER_HOUR);\n    return agoOf(hours, 'hour');\n  }\n  const days = Math.floor(minutes / MINUTES_PER_DAY);\n  return agoOf(days, 'day');\n}\n",
      "type": "registry:component",
      "target": "components/timeline/_parts/dates.ts"
    },
    {
      "path": "registry/ndeko/components/timeline/_parts/markers.ts",
      "content": "/*\n * A marker wider than the 16px dot. Its size is --marker, set on the timeline: the row, the marker\n * and the rail are all placed from it, so the marker keeps its left edge on the edge of the piece.\n */\nexport const MARKER_ROW =\n  'group-data-[orientation=vertical]/timeline:ms-[calc(var(--marker)_+_1rem)]';\n\nexport const MARKER = [\n  'flex size-(--marker) items-center justify-center',\n  'group-data-[orientation=vertical]/timeline:-left-[calc(var(--marker)/2_+_1rem)]',\n].join(' ');\n\nexport const MARKER_RAIL = [\n  'group-data-[orientation=vertical]/timeline:-left-[calc(var(--marker)/2_+_1rem)]',\n  'group-data-[orientation=vertical]/timeline:h-[calc(100%_-_var(--marker)_-_0.25rem)]',\n  'group-data-[orientation=vertical]/timeline:translate-y-[calc(var(--marker)_+_0.125rem)]',\n].join(' ');\n",
      "type": "registry:component",
      "target": "components/timeline/_parts/markers.ts"
    }
  ],
  "categories": [
    "components",
    "timeline"
  ],
  "type": "registry:component"
}