{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "activity",
  "type": "registry:block",
  "title": "Activity block",
  "description": "A studio's activity as one screen: a filter by kind, then the events grouped by day, each one sentence with who and what in the foreground and the time in the mono. A deploy says how it ended in a tag, and Show earlier adds the day before below.",
  "registryDependencies": [
    "https://littmd.vercel.app/r/litt.json",
    "https://littmd.vercel.app/r/avatar.json",
    "https://littmd.vercel.app/r/button.json",
    "https://littmd.vercel.app/r/framed.json",
    "https://littmd.vercel.app/r/segmented.json",
    "https://littmd.vercel.app/r/states.json",
    "https://littmd.vercel.app/r/tag.json"
  ],
  "files": [
    {
      "path": "registry/litt/components/litt-blocks/activity.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n// @litt/activity 2026.11.03. What changed: https://littmd.vercel.app/changelog.md\n\n/**\n * Activity: what happened in the studio, newest first. A block: a whole screen built from the litt parts, to copy and\n * make your own. Swap the sample events at the top for your feed, and `earlier` for your next page; the layout and the\n * words stay.\n *\n * A title, a filter by kind, then the events grouped by day. Each event is one sentence: who, in the foreground, did\n * what, in the grey, to which thing, in the foreground again, with the time in tabular figures at the end. A deploy says how\n * it ended in a tag, in words. Show earlier adds the next day below without moving what you were reading, and a kind\n * with nothing in it says so. Nothing in the view is accent filled, and nothing moves on its own. Render it inside\n * your app's shell (the dashboard block's AppShell, for one).\n */\nimport { useId, useState } from \"react\";\nimport { Avatar } from \"../litt/avatar\";\nimport { Button } from \"../litt/button\";\nimport { Segmented } from \"../litt/segmented\";\nimport { Empty } from \"../litt/states\";\nimport { Tag, type TagStatus } from \"../litt/tag\";\nimport { Heading } from \"../litt/framed\";\n\n/* ----------------------------------------------------------------- data */\n\ntype Kind = \"deploy\" | \"comment\" | \"people\";\ntype Event = {\n  id: string;\n  kind: Kind;\n  who: string;\n  /** What they did, in the grey: \"deployed\", \"commented on\". */\n  did: string;\n  /** What they did it to, in the foreground. */\n  what: string;\n  /** More about it, on a second line: a comment's words, a branch. */\n  detail?: string;\n  /** How a deploy ended, as a tag. */\n  outcome?: { status: TagStatus; label: string };\n  time: string;\n};\ntype Day = { label: string; events: Event[] };\n\n/** The feed, a day at a time. Load yours; the newest day comes first. */\nconst DAYS: Day[] = [\n  {\n    label: \"Today\",\n    events: [\n      { id: \"1\", kind: \"deploy\", who: \"Ines Ortega\", did: \"deployed\", what: \"Halo site\", detail: \"main · 7be04d1\", outcome: { status: \"success\", label: \"Live\" }, time: \"14:02\" },\n      { id: \"2\", kind: \"comment\", who: \"Tomás Vega\", did: \"commented on\", what: \"Northwind rebrand\", detail: \"The new wordmark reads well small. Can we try it on the invoice?\", time: \"11:47\" },\n      { id: \"3\", kind: \"deploy\", who: \"Rui Santos\", did: \"deployed\", what: \"Lumen docs\", detail: \"fix/search · 2c91fd9\", outcome: { status: \"danger\", label: \"Failed\" }, time: \"10:15\" },\n    ],\n  },\n  {\n    label: \"Yesterday\",\n    events: [\n      { id: \"4\", kind: \"people\", who: \"Ines Ortega\", did: \"invited\", what: \"ada@marlowlabs.com\", detail: \"As an editor\", time: \"17:30\" },\n      { id: \"5\", kind: \"deploy\", who: \"Maya Lind\", did: \"deployed a preview of\", what: \"Atlas portfolio\", detail: \"redesign/grid · 4f02a1c\", outcome: { status: \"neutral\", label: \"Preview\" }, time: \"15:08\" },\n      { id: \"6\", kind: \"comment\", who: \"Maya Lind\", did: \"replied on\", what: \"Atlas portfolio\", detail: \"Moved the captions under the photos, as asked.\", time: \"09:22\" },\n    ],\n  },\n];\n\n/** The next day back, for Show earlier. A real feed fetches it. */\nconst EARLIER: Day = {\n  label: \"19 Oct\",\n  events: [\n    { id: \"7\", kind: \"people\", who: \"Rui Santos\", did: \"changed the role of\", what: \"Tomás Vega\", detail: \"From editor to viewer\", time: \"16:40\" },\n    { id: \"8\", kind: \"deploy\", who: \"Rui Santos\", did: \"deployed\", what: \"Northwind rebrand\", detail: \"main · e23f792\", outcome: { status: \"success\", label: \"Live\" }, time: \"12:05\" },\n  ],\n};\n\nconst KINDS = [\n  { value: \"all\", label: \"All\" },\n  { value: \"deploy\", label: \"Deploys\" },\n  { value: \"comment\", label: \"Comments\" },\n  { value: \"people\", label: \"People\" },\n];\nconst NONE: Record<string, string> = {\n  deploy: \"No deploys in these days.\",\n  comment: \"No comments in these days.\",\n  people: \"Nobody joined, left or changed role in these days.\",\n};\n\n/* ----------------------------------------------------------------- the screen */\n\nfunction EventRow({ event }: { event: Event }) {\n  return (\n    <li className=\"flex gap-3 border-t border-litt-line py-4 first:border-t-0\">\n      <Avatar name={event.who} size=\"sm\" decorative />\n      <div className=\"grid min-w-0 flex-1 gap-1\">\n        <p className=\"flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1\">\n          <span className=\"text-litt-body text-litt-fg-muted\">\n            <span className=\"text-litt-fg\">{event.who}</span> {event.did} <span className=\"text-litt-fg\">{event.what}</span>\n          </span>\n          <span className=\"text-litt-caption tabular-nums font-normal text-litt-fg-subtle\">{event.time}</span>\n        </p>\n        {(event.detail || event.outcome) && (\n          <p className=\"flex flex-wrap items-center gap-3\">\n            {event.outcome && <Tag status={event.outcome.status}>{event.outcome.label}</Tag>}\n            {/* A deploy's detail is a branch and a commit, code identifiers, so it is set in the mono. */}\n            {event.detail && <span className={\"min-w-0 text-litt-fg-subtle \" + (event.kind === \"deploy\" ? \"font-litt-mono text-litt-caption font-normal\" : \"text-litt-small\")}>{event.detail}</span>}\n          </p>\n        )}\n      </div>\n    </li>\n  );\n}\n\nfunction DayGroup({ day }: { day: Day }) {\n  const id = useId();\n  return (\n    <section aria-labelledby={id} className=\"grid gap-2\">\n      <Heading level={2} id={id} className=\"text-litt-caption text-litt-fg-subtle\">\n        {day.label}\n      </Heading>\n      <ul>\n        {day.events.map((e) => (\n          <EventRow key={e.id} event={e} />\n        ))}\n      </ul>\n    </section>\n  );\n}\n\nexport function Activity() {\n  const [kind, setKind] = useState(\"all\");\n  const [days, setDays] = useState(DAYS);\n  const more = !days.includes(EARLIER);\n\n  const shown = days.map((d) => ({ ...d, events: d.events.filter((e) => kind === \"all\" || e.kind === kind) })).filter((d) => d.events.length);\n\n  return (\n    <div className=\"@container grid w-full max-w-3xl grid-cols-1 gap-8\">\n      <header className=\"grid gap-1\">\n        <Heading level={1} className=\"text-litt-h1 text-litt-fg\">Activity</Heading>\n        <p className=\"text-litt-body text-litt-fg-muted\">Deploys, comments and people across the studio, newest first.</p>\n      </header>\n\n      <Segmented legend=\"Show\" size=\"sm\" value={kind} onValueChange={setKind} options={KINDS} />\n\n      {shown.length ? (\n        <div className=\"grid gap-8\">\n          {shown.map((d) => (\n            <DayGroup key={d.label} day={d} />\n          ))}\n        </div>\n      ) : (\n        <Empty title={NONE[kind]} action={<Button size=\"sm\" onClick={() => setKind(\"all\")}>Show everything</Button>}>\n          {more ? \"Show earlier to look further back.\" : \"That is everything in the feed.\"}\n        </Empty>\n      )}\n\n      {more && (\n        <Button variant=\"ghost\" size=\"sm\" className=\"justify-self-start\" onClick={() => setDays([...days, EARLIER])}>\n          Show earlier\n        </Button>\n      )}\n    </div>\n  );\n}\n",
      "target": "components/litt-blocks/activity.tsx"
    }
  ],
  "docs": "Import Activity from components/litt-blocks/activity and render it inside your app's shell. The sample days sit at the top of the file, newest first; Show earlier is where your next page loads. See it live at https://littmd.vercel.app/#activity.",
  "meta": {
    "version": "2026.11.03",
    "released": "2026-11-03",
    "changelog": "https://littmd.vercel.app/changelog.md"
  }
}
