Mentions, thread replies and reactions aimed at you, with filters and mark read.
- MPMira Patel mentioned you in #design-crit@Maya Chen love it. Can you mock the sticky header for tomorrow's review?
- BOBen Okafor and 1 other replied in a thread in #eng-platformSplit done, build #1284 is green.
- LFLena Fischer reacted 🎉 to your message in #launch-q3Hero illustration direction is set: we're going with the night-sky version ✨
- DRDana Ruiz mentioned you in #incidents@Maya Chen the upgrade dialog is cut off on tablets. Screenshot in the thread.
import { UiSchema } from "@effect/ui"import { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { Schema } from "effect"import { ActivityFilter, ActivityInbox, ActivityItem } from "./ui/uicontext/components/kit/ActivityInbox.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { color, radius } from "./ui/uicontext/components/tokens.stylex.ts"import { activity, now } from "./chat.ts"const styles = stylex.create({ frame: { inlineSize: "min(100%, 44rem)", overflow: "hidden", borderWidth: 1, borderStyle: "solid", borderColor: color.line, borderRadius: radius.lg, backgroundColor: color.panel },})const Message = UiSchema.TaggedEnum({ ChoseFilter: { filter: ActivityFilter }, ReadItems: { ids: Schema.Array(Schema.String) },})// Filter by kind, mark one read, or Mark all read for what the filter showsexport const MyActivity = Html.component({ name: "MyActivity", model: Schema.Struct({ items: Schema.Array(ActivityItem), filter: ActivityFilter }), message: Message,}).make({ init: () => ({ items: activity, filter: "all" as const }), update: { ChoseFilter: ($, { filter }) => $.evolve({ filter }), ReadItems: ($, { ids }) => $.evolve({ items: (all) => all.map((i) => (ids.includes(i.id) ? { ...i, unread: false } : i)) }), }, view: (h, model) => h.div.attrs(sx(styles.frame)).children(ActivityInbox(h, { props: { items: model.items, filter: model.filter, now }, onEmit: { RequestedFilter: ({ filter }) => Message.ChoseFilter({ filter }), RequestedMarkRead: ({ id }) => Message.ReadItems({ ids: [id] }), RequestedMarkAllRead: ({ ids }) => Message.ReadItems({ ids }), }, })),})Installation
pnpm dlx shadcn@latest add checkfu/uicontext/activity-inboxUsage
import { ActivityFilter, ActivityInbox, type ActivityItem } from "./ui/uicontext/components/kit/ActivityInbox.ts"const Message = UiSchema.TaggedEnum({ ChoseFilter: { filter: ActivityFilter }, ReadItems: { ids: Schema.Array(Schema.String) },})export const Inbox = (h: Html.H<typeof Message.Type>, items: ReadonlyArray<ActivityItem>, filter: ActivityFilter, now: string) => ActivityInbox(h, { props: { items, filter, now }, onEmit: { RequestedFilter: ({ filter }) => Message.ChoseFilter({ filter }), RequestedMarkRead: ({ id }) => Message.ReadItems({ ids: [id] }), RequestedMarkAllRead: ({ ids }) => Message.ReadItems({ ids }), }, })Examples
Nothing yet
Nothing yet. Mentions, replies and reactions land here.
import type { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { ActivityInbox } from "./ui/uicontext/components/kit/ActivityInbox.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { color, radius } from "./ui/uicontext/components/tokens.stylex.ts"import { now } from "./chat.ts"const styles = stylex.create({ frame: { inlineSize: "min(100%, 44rem)", overflow: "hidden", borderWidth: 1, borderStyle: "solid", borderColor: color.line, borderRadius: radius.lg, backgroundColor: color.panel },})// Nothing yet: the empty state says what will land hereexport const CaughtUp = <M>(h: Html.H<M>) => h.div.attrs(sx(styles.frame)).children(ActivityInbox(h, { props: { agentId: "activity-caught-up", items: [], filter: "all", now }, onEmit: { RequestedFilter: () => undefined, RequestedMarkRead: () => undefined, RequestedMarkAllRead: () => undefined }, }))API reference
Props
| Name | Type | Description |
|---|---|---|
itemsrequired | ActivityItem[] | — |
filterrequired | ActivityFilter | — |
nowrequired | string | The time now, ISO: "5 minutes ago" |
agentId | string | — |
Events
| Event | Payload | Description |
|---|---|---|
RequestedFilter | { filter: ActivityFilter } | — |
RequestedMarkRead | { id: string } | Mark one item read: its Mark read button, or opening it |
RequestedMarkAllRead | { ids: string[] } | Mark every item the filter shows read |
Agent actions
| Action | Description |
|---|---|
ClickedFilter | Show all activity, or only mentions, threads or reactions |
ClickedMarkRead | Mark one item read, by id |
ClickedMarkAllRead | Mark everything the filter shows read |
Accessibility
- Filters are toggle buttons with their unread counts. Each row is a link that says who did what where, with its time and Mark read.
- Mark all read applies to what the filter shows; the empty state says what lands here.