diff --git a/packages/iios-messaging-ui/src/components/conversation-list.tsx b/packages/iios-messaging-ui/src/components/conversation-list.tsx new file mode 100644 index 0000000..14e75fb --- /dev/null +++ b/packages/iios-messaging-ui/src/components/conversation-list.tsx @@ -0,0 +1,52 @@ +import type { Conversation } from '../types'; + +/** Initials for the avatar chip — first letters of the first two words. */ +function initials(title: string): string { + const parts = title.trim().split(/\s+/).filter(Boolean); + const chars = (parts[0]?.[0] ?? '') + (parts[1]?.[0] ?? ''); + return (chars || '?').toUpperCase(); +} + +/** + * Presentational conversation list. Owns no data fetching — the parent passes the + * conversations (from useConversations) so a host can also drive it from its own store. + */ +export function ConversationList({ + conversations, + selectedId, + onSelect, +}: { + conversations: Conversation[]; + selectedId?: string | null; + onSelect: (threadId: string) => void; +}) { + if (conversations.length === 0) { + return