Conversation List

Chats by Today, Yesterday and earlier, with search, pinning, projects, rename in place, share and delete.

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/conversation-list

Usage

import { ConversationList } from "./ui/uicontext/components/chat/ConversationList.ts"import type { ChatProject, ConversationSummary } from "./ui/uicontext/components/domain/Chat.ts"
const Message = UiSchema.TaggedEnum({	RenamedChat: { id: Schema.String, title: Schema.String },	PinnedChat: { id: Schema.String, pinned: Schema.Boolean },	MovedChat: { id: Schema.String, project: Schema.NullOr(Schema.String) },	SharedChat: { id: Schema.String },	DeletedChat: { id: Schema.String },})// apply each change to your list at once, and offer Undo for a deleteexport const Chats = (h: Html.H<typeof Message.Type>, chats: ReadonlyArray<ConversationSummary>, projects: ReadonlyArray<ChatProject>, now: string, current?: string) =>	ConversationList(h, {		props: { conversations: chats, projects, now, href: "/c/:id", ...(current === undefined ? {} : { current }) },		onEmit: {			RequestedRename: ({ id, title }) => Message.RenamedChat({ id, title }),			RequestedPin: ({ id, pinned }) => Message.PinnedChat({ id, pinned }),			RequestedMove: ({ id, project }) => Message.MovedChat({ id, project }),			RequestedShare: ({ id }) => Message.SharedChat({ id }),			RequestedDelete: ({ id }) => Message.DeletedChat({ id }),		},	})

Examples

Before the first chat

A new account has nothing to list yet, and the list says where chats will appear.

No chats yet. Your conversations show up here.

API reference

Props

ConversationList props
NameTypeDescription
conversationsrequiredConversationSummary[]—
projectsChatProject[]—
currentstringThe open conversation's id
nowrequiredstringThe present, ISO, for the date groups; the app's clock, never read here
hrefrequiredstringA conversation's link, with :id where its id goes: "/c/:id"
timeZonestringThe time zone the date groups follow; the reader's own when left out
agentIdstringThe id agents see this list by

Events

ConversationList events
EventPayloadDescription
RequestedRename{ id: string; title: string }—
RequestedPin{ id: string; pinned: boolean }—
RequestedMove{ id: string; project: string | null }File it under project, or take it out of any with null
RequestedShare{ id: string }—
RequestedDelete{ id: string }—

Agent actions

What agents can do with ConversationList
ActionDescription
ChangedQuerySearch the chats by title
PickedRowActionRename (pass title), pin, unpin, share or delete a chat by its id

Source