Activity Feed

What happened to a record, who did it and when.

Sunday, Nov 29

  1. Ben Okaforcreated the issue

    set the priority toUrgent

    added the labelCheckout

Yesterday

  1. Nightly triagechanged the statusBacklog→Todo

Today

  1. ScoutforAda Lovelacevia team chatlinkedPAY-398Open

    Same stack trace: the retry reuses the first attempt's idempotency key.

  2. Mira Patelassigned the issue toMira Patel

    changed the statusTodo→In Progress

  3. Mira Pateledited the description

  4. Ada Lovelacechanged the statusIn Progress→In Review

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/activity

Usage

import { Activity, type ActivityEntry } from "./ui/uicontext/components/kit/Activity.ts"
const Message = UiSchema.TaggedEnum({ RequestedRestore: { entry: Schema.String } })// the app keeps the entries; `now` makes times read "2 hours ago" and days "Today"export const IssueActivity = (h: Html.H<typeof Message.Type>, entries: ReadonlyArray<ActivityEntry>, now: string) =>	Activity(h, {		props: { label: "Activity", entries, now },		onEmit: { RequestedRestore: ({ entry }) => Message.RequestedRestore({ entry }) },	})

Examples

A long history

2,400 entries: the newest 25 show, and each press adds 25 more. Runs of one actor's changes fold.

Today

  1. Inventory syncvia the APIupdated supplier to375

    updated stock to412

    updated reorder point to449

Versions, newest first

presentation: "compact" gives each version its own row; restoreDisabled says why Restore is off.

Scout is still writing. Restore when it finishes.

  1. ScoutforAda Lovelacerewrote the summary

  2. Ada Lovelaceadded the rollout plan

  3. Mira Pateledited the goals

  4. Ada Lovelacecreated the page

API reference

Props

Activity props
NameTypeDefaultDescription
labelrequiredstring—The feed's accessible name: "Activity"
agentIdstringactivity:<label>This feed's id for agents, unique on the page; activity:<label> by default
entriesrequiredActivityEntry[]—What happened, each with its actor, verb, target and time
nowstring—Now, as an ISO timestamp, for "2 hours ago"; absolute dates when absent
shownnumber20How many of the newest entries show, and how many more each "Show earlier" adds; 20 by default
order"oldest-first" | "newest-first"—The order the application already supplied. Oldest first by default.
presentation"timeline" | "compact"—Compact gives every entry its own row. Timeline groups nearby entries by actor.
restoreDisabledstring—Why restoring isn't possible now: "A generation is in progress"
loadingboolean—Shows placeholder rows while the entries load
localestring—The locale dates and times are formatted in; the browser's by default
timeZonestring—The time zone times are shown in; the reader's when left out

Events

Activity events
EventPayloadDescription
RequestedRestore{ entry: string }Bring back the version this entry recorded

Agent actions

What agents can do with Activity
ActionDescription
ClickedRestoreasks firstRestore the object to this entry's version; it replaces the current one
ClickedShowEarlierShow the earlier entries

Accessibility

  • The history is an ordered list in a named section, and each time is a <time> with the full date as a tooltip.
  • Restore is a real button; when restoring is off, the reason is tied to it as its description.
  • Agents read the entries, who acted for whom, and must name the entry they restore.

Source