Channel Header

A conversation's name, topic, members, call button, notification settings and tabs.

design-crit

Post work in progress. Be kind, be specific.

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/channel-header

Usage

import { ChannelHeader, ChannelTab, NotifyLevel } from "./ui/uicontext/components/kit/ChannelHeader.ts"
const Message = UiSchema.TaggedEnum({	ChoseTab: { tab: ChannelTab },	ChoseNotify: { level: NotifyLevel },	ToggledMute: { muted: Schema.Boolean },	StartedCall: {},})export const Header = (h: Html.H<typeof Message.Type>, tab: ChannelTab, notify: NotifyLevel, muted: boolean) =>	ChannelHeader(h, {		props: { name: "general", kind: "public", topic: "Company-wide news.", members: { total: 58, faces: [] }, call: null, notify, muted, tab },		onEmit: {			RequestedTab: ({ tab }) => Message.ChoseTab({ tab }),			RequestedNotify: ({ level }) => Message.ChoseNotify({ level }),			RequestedMute: ({ muted }) => Message.ToggledMute({ muted }),			RequestedCall: () => Message.StartedCall(),			RequestedMembers: () => undefined,			RequestedCopyLink: () => undefined,		},	})

Examples

Direct message

Ben Okafor

API reference

Props

ChannelHeader props
NameTypeDescription
namerequiredstringThe channel's name without "#", or the person's name
kindrequiredConversationKind—
idstringThe conversation's id: a DM's face is drawn from it
topicstring—
presencePresenceA DM's person: whether they're here, and their status
statusstring—
membersrequired{ total, faces }—
callrequired{ people, joined } | nullA call in this conversation: who's in it, and whether the reader is
notifyrequiredNotifyLevel—
mutedrequiredboolean—
tabrequiredChannelTab—
filesnumber—
pinsnumber—
backstringA printed route: on a phone, the Back link that leads to the list
agentIdstring—

Events

ChannelHeader events
EventPayloadDescription
RequestedTab{ tab: ChannelTab }—
RequestedCall{}Start a call here, or join the one going on
RequestedMembers{}—
RequestedNotify{ level: NotifyLevel }—
RequestedMute{ muted: boolean }—
RequestedCopyLink{}Copy the conversation's link

Agent actions

What agents can do with ChannelHeader
ActionDescription
ClickedTabShow the conversation's messages, files or pins
ClickedCallStart a call in this conversation, or join the one going on
PickedNotifyLevelSet notifications: group "notify", value all, mentions or nothing

Accessibility

  • The name is a heading; the members, call and options are named buttons, and the call button says when a call is going on.
  • Messages, Files and Pins are tabs; notifications are a radio group in the options menu, and Mute a checkbox item.

Source