{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "timeline-09",
  "title": "Event log",
  "description": "System events in one card, each with a status dot and its date and time.",
  "dependencies": [
    "date-fns"
  ],
  "registryDependencies": [
    "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-09.tsx",
      "content": "import { cn } from '@/registry/ndeko/lib/utils';\nimport {\n  Timeline,\n  TimelineContent,\n  TimelineDate,\n  TimelineItem,\n} from '@/registry/ndeko/ui/timeline';\n\nimport { stampLabelOf } from './_parts/dates';\n\ntype Tone = 'done' | 'notice' | 'warning';\n\ntype LogEntry = {\n  at: string;\n  message: string;\n  tone: Tone;\n};\n\nconst WAREHOUSE_LOG: LogEntry[] = [\n  {\n    at: '2026-11-12T10:55:00',\n    message: 'Pallet BS-20418 put away in rack 01-B.',\n    tone: 'done',\n  },\n  {\n    at: '2026-11-12T10:50:00',\n    message: 'Cold room door left open for more than two minutes.',\n    tone: 'warning',\n  },\n  {\n    at: '2026-11-12T10:45:00',\n    message: 'Dock 2 scanner back online after a restart.',\n    tone: 'done',\n  },\n  {\n    at: '2026-11-12T10:40:00',\n    message: 'Stock count started for aisle 02.',\n    tone: 'notice',\n  },\n];\n\nconst TONE_DOT: Record<Tone, string> = {\n  done: 'bg-success',\n  notice: 'bg-info',\n  warning: 'bg-warning',\n};\n\nconst TONE_WORD: Record<Tone, string> = {\n  done: 'Done',\n  notice: 'Notice',\n  warning: 'Warning',\n};\n\nconst LOG_CARD =\n  'bg-card hairline-ring ring-border w-full max-w-md rounded-xl py-1.5 shadow-[0_1px_2px_rgb(0_0_0/0.04)]';\n\n/* The log has no rail: each row gives back the room the timeline keeps for one. */\nconst LOG_ROW = [\n  'flex-row gap-2.5 px-4 py-2.5',\n  'group-data-[orientation=vertical]/timeline:ms-0 group-data-[orientation=vertical]/timeline:not-last:pb-2.5',\n].join(' ');\n\ntype ToneDotProps = {\n  tone: Tone;\n};\n\n/* The dot sits in a box as tall as one line of text, so it stays on the first line of a long message. */\nfunction ToneDot({ tone }: ToneDotProps) {\n  const color = TONE_DOT[tone];\n\n  return (\n    <span aria-hidden='true' className='flex h-5 shrink-0 items-center'>\n      <span className={cn('size-1.5 rounded-full', color)} />\n    </span>\n  );\n}\n\nexport default function Timeline09() {\n  return (\n    <Timeline\n      role='list'\n      aria-label='Brightmoor Supply warehouse log'\n      className={LOG_CARD}\n    >\n      {WAREHOUSE_LOG.map((entry, index) => {\n        const step = index + 1;\n\n        return (\n          <TimelineItem\n            key={entry.at}\n            step={step}\n            role='listitem'\n            className={LOG_ROW}\n          >\n            <ToneDot tone={entry.tone} />\n            <TimelineContent className='text-foreground leading-5'>\n              <span className='sr-only'>{TONE_WORD[entry.tone]}: </span>\n              {entry.message}\n              <TimelineDate dateTime={entry.at} className='mt-1 mb-0'>\n                {stampLabelOf(entry.at)}\n              </TimelineDate>\n            </TimelineContent>\n          </TimelineItem>\n        );\n      })}\n    </Timeline>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/timeline/timeline-09.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"
    }
  ],
  "categories": [
    "components",
    "timeline"
  ],
  "type": "registry:component"
}