Skip to content

The agent that grows with you

fix: integrate group attention with room ordering and working avatars

Tekniumbc952a78ce8b
diff --cc apps/desktop/src/plugins/hermes-bots/roster-pane-derivation.ts
index d83f1677de1,00000000000..94681c52da1
mode 100644,000000..100644
--- a/apps/desktop/src/plugins/hermes-bots/roster-pane-derivation.ts
+++ b/apps/desktop/src/plugins/hermes-bots/roster-pane-derivation.ts
@@@ -1,248 -1,0 +1,237 @@@
+import { botActivitySession } from './data'
+import { botRosterKey, filterBots, preferReachableSameNameRows } from './data'
+import type { $groupChats } from './group-chat'
+import { groupChatMemberBots, groupChatNames, groupLastActivity } from './group-membership'
++import { sortGroupRosterRows } from './group-order'
+import { isBotPinned } from './hidden-bots'
+import { isBotHidden } from './hidden-bots'
+import { filterBotsByGateway, groupMatchesRosterFilters, rosterGatewaySections } from './roster-sections'
+import type { rosterGatewayOptions } from './roster-sections'
+import { botRosterMeta } from './routing'
+import { BOT_ROSTER_SEARCH_THRESHOLD } from './row-helpers'
+import { ACTIVE_WINDOW_S, rosterActivityMatches } from './row-helpers'
+import type { BotMeta, GroupMember, RosterActivityFilter, RosterKindFilter, RosterRow } from './types'
+/** The two row shapes the roster sorts together — `kind` is the discriminant. */
+interface RosterBotRow {
+ active: boolean
+ activity: number
+ bot: RosterRow
+ kind: 'bot'
+ pinned: boolean
+}
+export interface RosterGroupRow {
+ active: boolean
+ activity: number
+ kind: 'group'
+ members: GroupMember[]
+ name: string
+ pinned: boolean
+}
+
+interface RosterRowsInput {
+ roster: RosterRow[]
+ allMeta: Record<string, BotMeta>
+ gatewayFilter: string
+ query: string
+ activityFilter: RosterActivityFilter
+ rowKindFilter: RosterKindFilter
+ groupRooms: ReturnType<typeof $groupChats.get>
+ activeRosterKeys: Set<string>
+ gatewayOptions: ReturnType<typeof rosterGatewayOptions>
+ activityOf: (bot: RosterRow) => number
+ isPinned: (bot: RosterRow) => boolean
+}
+
+export function deriveRosterRows({
+ roster,
+ allMeta,
+ gatewayFilter,
+ query,
+ activityFilter,
+ rowKindFilter,
+ groupRooms,
+ activeRosterKeys,
+ gatewayOptions,
+ activityOf,
+ isPinned
+}: RosterRowsInput) {
+ const activeSourceRoster = roster.filter(bot => !bot.remoteSource)
+ // Hidden rows remain fully alive and recoverable at the bottom. Every
+ // non-display consumer continues to receive the complete roster.
+ const hiddenBots = roster.filter(bot => isBotHidden(bot, allMeta))
+ const visibleRoster = roster.filter(bot => !isBotHidden(bot, allMeta))
+ const gatewayRoster = filterBotsByGateway(visibleRoster, gatewayFilter)
+
+ const filteredRoster = filterBots(gatewayRoster, allMeta, query).filter((bot: RosterRow) =>
+ rosterActivityMatches(
+ {
+ activity: activityOf(bot),
+ active: activeRosterKeys.has(botRosterKey(bot))
+ },
+ activityFilter
+ )
+ )
+
+ const filteredHiddenBots = filterBots(filterBotsByGateway(hiddenBots, gatewayFilter), allMeta, query).filter(
+ (bot: RosterRow) =>
+ rosterActivityMatches(
+ {
+ activity: activityOf(bot),
+ active: activeRosterKeys.has(botRosterKey(bot))
+ },
+ activityFilter
+ )
+ )
+
+ const groupNames = groupChatNames(allMeta, groupRooms)
+
+ const groupRows = groupNames
+ .map(name => ({
+ name,
+ members: groupChatMemberBots(name, roster, allMeta)
+ }))
+ .filter(row => groupMatchesRosterFilters(row.name, row.members, allMeta, query, gatewayFilter))
+ .map((row): RosterGroupRow => ({
+ kind: 'group',
+ name: row.name,
+ members: row.members,
+ pinned: Boolean(groupRooms[row.name]?.pinned),
+ activity: groupLastActivity(groupRooms[row.name]),
+ active:
+ Boolean(
+ groupLastActivity(groupRooms[row.name]) &&
+ Date.now() - groupLastActivity(groupRooms[row.name]) <= ACTIVE_WINDOW_S * 1000
+ ) || row.members.some(member => activeRosterKeys.has(botRosterKey(member)))
+ }))
+ .filter(row => rowKindFilter !== 'bots' && rosterActivityMatches(row, activityFilter))
+
+ const botRows =
+ rowKindFilter === 'groups'
+ ? []
+ : preferReachableSameNameRows(filteredRoster).map((bot): RosterBotRow => ({
+ kind: 'bot',
+ bot,
+ pinned: isPinned(bot),
+ activity: activityOf(bot),
+ active: activeRosterKeys.has(botRosterKey(bot))
+ }))
+
- const sortRosterRows = <T extends { activity: number; pinned: boolean }>(rows: T[]): T[] =>
- rows.slice().sort((a, b) => {
- const pa = a.pinned ? 1 : 0
- const pb = b.pinned ? 1 : 0
-
- if (pa !== pb) {
- return pb - pa
- }
-
- return b.activity - a.activity
- })
-
- const rosterRows = sortRosterRows([...botRows, ...groupRows])
- const sortedGroupRows = sortRosterRows(groupRows)
++ const rosterRows = sortGroupRosterRows([...botRows, ...groupRows], groupRooms)
++ const sortedGroupRows = sortGroupRosterRows(groupRows, groupRooms)
+ const gatewaySections = rosterGatewaySections(botRows, gatewayOptions, gatewayFilter)
+ const showGatewaySections = gatewaySections.sectioned && botRows.length > 0
+
+ return {
+ activeSourceRoster,
+ hiddenBots,
+ visibleRoster,
+ filteredHiddenBots,
+ groupNames,
+ rosterRows,
+ sortedGroupRows,
+ gatewaySections,
+ showGatewaySections
+ }
+}
+
+interface RosterPresentationInput {
+ rowKindFilter: RosterKindFilter
+ activityFilter: RosterActivityFilter
+ gatewayFilter: string
+ query: string
+ filteredHiddenBots: RosterRow[]
+ hiddenBots: RosterRow[]
+ hiddenExpanded: boolean
+ roster: RosterRow[]
+ groupNames: string[]
+ visibleRoster: RosterRow[]
+ gatewayOptions: ReturnType<typeof rosterGatewayOptions>
+}
+
+export function deriveRosterPresentation({
+ rowKindFilter,
+ activityFilter,
+ gatewayFilter,
+ query,
+ filteredHiddenBots,
+ hiddenBots,
+ hiddenExpanded,
+ roster,
+ groupNames,
+ visibleRoster,
+ gatewayOptions
+}: RosterPresentationInput) {
+ const activeFilterCount =
+ (rowKindFilter === 'all' ? 0 : 1) + (activityFilter === 'all' ? 0 : 1) + (gatewayFilter === 'all' ? 0 : 1)
+
+ const hasRosterConstraint = Boolean(query.trim()) || activeFilterCount > 0
+ const matchingHiddenBots = rowKindFilter === 'groups' ? [] : filteredHiddenBots
+ const showHiddenSection = hiddenBots.length > 0 && (!hasRosterConstraint || matchingHiddenBots.length > 0)
+ const showHiddenRows = hiddenExpanded || hasRosterConstraint
+ const rosterItemCount = roster.length + groupNames.length
+
+ const allBotsHidden =
+ !hasRosterConstraint && visibleRoster.length === 0 && groupNames.length === 0 && hiddenBots.length > 0
+
+ const showRosterSearch =
+ gatewayOptions.length > 1 || rosterItemCount >= BOT_ROSTER_SEARCH_THRESHOLD || Boolean(query.trim())
+
+ const showRosterFilters =
+ gatewayOptions.length > 1 ||
+ groupNames.length > 0 ||
+ rosterItemCount >= BOT_ROSTER_SEARCH_THRESHOLD ||
+ activeFilterCount > 0
+
+ const showRosterTools = showRosterSearch || showRosterFilters
+
+ const hiddenGatewaySections = rosterGatewaySections(
+ matchingHiddenBots.map((bot: RosterRow) => ({
+ kind: 'bot',
+ bot
+ })),
+ gatewayOptions,
+ gatewayFilter
+ )
+
+ return {
+ activeFilterCount,
+ hasRosterConstraint,
+ matchingHiddenBots,
+ showHiddenSection,
+ showHiddenRows,
+ allBotsHidden,
+ showRosterSearch,
+ showRosterFilters,
+ showRosterTools,
+ hiddenGatewaySections
+ }
+}
+
+export function sortRosterBots(sourceWithSelectedOwner: RosterRow[], allMeta: Record<string, BotMeta>) {
+ // Messaging-app order: most recent activity first, where "activity" is
+ // the newest of (bot created, last message in any of its sessions). A
+ // freshly created bot tops the list until another bot gets a message.
+ // No special slot for the primary bot — it competes on recency too.
+ const activityOf = (bot: RosterRow): number => {
+ const created = botRosterMeta(bot, allMeta)?.created || bot.ui_meta?.['hermes-bots']?.created || 0
+ const lastMsg = (botActivitySession(bot)?.last_active || 0) * 1000
+
+ return Math.max(created, lastMsg)
+ }
+
+ // Pin is a source-qualified Desktop preference, not gateway profile state.
+ const isPinned = (bot: RosterRow): boolean => isBotPinned(bot, allMeta)
+
+ const roster = sourceWithSelectedOwner.slice().sort((a, b) => {
+ const pa = isPinned(a) ? 1 : 0
+ const pb = isPinned(b) ? 1 : 0
+
+ if (pa !== pb) {
+ return pb - pa
+ }
+
+ return activityOf(b) - activityOf(a)
+ })
+
+ return { roster, activityOf, isPinned }
+}
diff --cc apps/desktop/src/plugins/hermes-bots/roster-pane-groups.tsx
index 00000000000,00000000000..417aa656663
new file mode 100644
--- /dev/null
+++ b/apps/desktop/src/plugins/hermes-bots/roster-pane-groups.tsx
@@@ -1,0 -1,0 +1,76 @@@
++import { Button, Codicon, Tip } from '@hermes/plugin-sdk'
++import type { ComponentProps } from 'react'
++
++import { GroupRow } from './bot-row'
++import { $botMeta } from './data'
++import { $groupChats, updateGroupChat } from './group-chat'
++import type { $groupClarify, $groupNeedsYou } from './group-chat'
++import { groupChatNames, groupLastActivity } from './group-membership'
++import { reorderGroupRows, sortGroupRosterRows } from './group-order'
++import { groupHasPendingClarify } from './group-turns'
++import type { useBots } from './i18n'
++import type { RosterGroupRow } from './roster-pane-derivation'
++
++interface RosterGroupRowViewProps extends Omit<ComponentProps<typeof GroupRow>, 'needsYou'> {
++ b: ReturnType<typeof useBots>
++ groupClarify: ReturnType<typeof $groupClarify.get>
++ groupNeedsYou: ReturnType<typeof $groupNeedsYou.get>
++ groupRooms: ReturnType<typeof $groupChats.get>
++ sortedGroupRows: RosterGroupRow[]
++}
++
++export function RosterGroupRowView({
++ b,
++ groupClarify,
++ groupNeedsYou,
++ groupRooms,
++ sortedGroupRows,
++ ...rowProps
++}: RosterGroupRowViewProps) {
++ const moveRoom = (name: string, delta: -1 | 1) => {
++ // Read at the gesture, not the last render: a sync or disband may have
++ // replaced this room in the meantime. Ordering never writes bot metadata.
++ const current = $groupChats.get()
++
++ if (current[name]?.roomId !== groupRooms[name]?.roomId || current[name]?.tombstone) {
++ return
++ }
++
++ const rows = groupChatNames($botMeta.get(), current).map(name => ({
++ kind: 'group' as const,
++ name,
++ pinned: Boolean(current[name]?.pinned),
++ activity: groupLastActivity(current[name])
++ }))
++
++ const order = reorderGroupRows(sortGroupRosterRows(rows, current), name, delta, sortedGroupRows.map(row => row.name))
++
++ order?.forEach((name, rosterOrder) => {
++ updateGroupChat(name, room => ({ ...room, rosterOrder }), { sync: false })
++ })
++ }
++
++ return (
++ <div className="grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center">
++ <GroupRow
++ {...rowProps}
++ needsYou={Boolean(groupNeedsYou[rowProps.group]) || groupHasPendingClarify(groupClarify, rowProps.group)}
++ />
++ <div className="flex flex-col">
++ {([-1, 1] as const).map(delta => (
++ <Tip key={delta} label={delta === -1 ? b.sections.moveUp : b.sections.moveDown}>
++ <Button
++ aria-label={`${rowProps.group}: ${delta === -1 ? b.sections.moveUp : b.sections.moveDown}`}
++ disabled={!reorderGroupRows(sortedGroupRows, rowProps.group, delta)}
++ onClick={() => moveRoom(rowProps.group, delta)}
++ size="icon-xs"
++ variant="ghost"
++ >
++ <Codicon name={delta === -1 ? 'chevron-up' : 'chevron-down'} />
++ </Button>
++ </Tip>
++ ))}
++ </div>
++ </div>
++ )
++}
diff --cc apps/desktop/src/plugins/hermes-bots/roster-pane.tsx
index 1401c350425,e8f7738973a..ceaeae3145e
--- a/apps/desktop/src/plugins/hermes-bots/roster-pane.tsx
+++ b/apps/desktop/src/plugins/hermes-bots/roster-pane.tsx
@@@ -1,7 -1,36 +1,7 @@@
-/**
- * The Bots pane itself: the roster's selection reconciliation, the
- * workspace-ownership reads its lifecycle keys off, and the pane that lists
- * every bot and group chat.
- *
- * The top of the roster stack. It composes the rows, the section headings and
- * the dialogs; nothing in Bot Mode imports it except the plugin entry point.
- */
-
-import {
- atom,
- Button,
- cn,
- Codicon,
- ConfirmDialog,
- DisclosureCaret,
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuSeparator,
- DropdownMenuTrigger,
- GlyphSpinner,
- host,
- PanelEmpty,
- RowButton,
- SearchField,
- Tip,
- useI18n,
- useValue
-} from '@hermes/plugin-sdk'
+import { host, useI18n, useValue } from '@hermes/plugin-sdk'
import { useEffect, useRef, useState } from 'react'
--import { BotRow, GroupRow } from './bot-row'
++import { BotRow } from './bot-row'
import {
$botChatFocused,
$botsPaneVisible,
@@@ -30,26 -55,49 +32,26 @@@ import
sourceByConnection,
useRoster
} from './data'
-import { EditProfileDialog } from './edit-profile-dialog'
-import { $groupChats, $groupChatWorkspace, $groupNeedsYou, updateGroupChat } from './group-chat'
-import { disbandGroupChat, GroupChatWorkspace, openGroupChat } from './group-chat-view'
-import { groupChatMemberBots, groupChatNames, groupLastActivity } from './group-membership'
-import { reorderGroupRows, sortGroupRosterRows } from './group-order'
+import { $groupChats, $groupChatWorkspace, $groupClarify, $groupNeedsYou } from './group-chat'
+import { GroupChatWorkspace, openGroupChat } from './group-chat-view'
+import { groupChatMemberBots } from './group-membership'
import { $groupMainTabsRev, shouldRenderGroupChatInPane } from './group-panes'
- import { groupHasPendingClarify } from './group-turns'
-import { $showHiddenBots, isBotHidden, isBotPinned } from './hidden-bots'
+import { $showHiddenBots, isBotHidden } from './hidden-bots'
import { useBots } from './i18n'
-import { displayName } from './labels'
-import { deleteBot, mergeServerMeta, pullServerAvatars } from './profile-ops'
-import { $activityToasts, setActivityToasts, trackInboundActivity } from './roster-actions'
-import {
- botNeedsHandleLabel,
- filterBotsByGateway,
- GatewayKindGlyph,
- GatewaySectionHeading,
- groupMatchesRosterFilters,
- rosterGatewayOptions,
- rosterGatewaySections,
- RosterSectionHeader
-} from './roster-sections'
-import type { ResolvedRosterGatewaySection } from './roster-sections'
-import { botRosterMeta, botWorkspaceOwnerKey, setBotsWorkspaceOwner } from './routing'
-import { ACTIVE_WINDOW_S, activeBots, BOT_ROSTER_SEARCH_THRESHOLD, rosterActivityMatches, useTurnBusy } from './row-helpers'
-import { backfillMessagingProtocol } from './soul'
+import { $activityToasts } from './roster-actions'
+import { renderRosterContent } from './roster-pane-content'
+import { deriveRosterPresentation, deriveRosterRows, sortRosterBots } from './roster-pane-derivation'
+import { renderRosterDialogs } from './roster-pane-dialogs'
++import { RosterGroupRowView } from './roster-pane-groups'
+import { $lastSources, usePublishRosterSnapshot } from './roster-pane-lifecycle'
+import { rosterSectionRenderers } from './roster-pane-sections'
+import { renderRosterToolbar } from './roster-pane-toolbar'
+import { botNeedsHandleLabel, rosterGatewayOptions } from './roster-sections'
+import { botWorkspaceOwnerKey, setBotsWorkspaceOwner } from './routing'
- import { activeBots } from './row-helpers'
++import { activeBots, useTurnBusy } from './row-helpers'
import type { BotMeta, GatewaySource, GroupMember, RosterActivityFilter, RosterKindFilter, RosterRow } from './types'
-import {
- $botSections,
- $draggingBot,
- createBotSection,
- deleteBotSection,
- groupRowsBySection,
- moveBotSection,
- moveBotsToSection,
- renameBotSection,
- UNASSIGNED_SECTION_KEY
-} from './user-sections'
-import { SectionDropZone, SectionNameDialog, useEscapeCancelsBotDrag, UserSectionHeader } from './user-sections-ui'
-
-/** Last source inventory returned by the desktop-wide agent roster. */
-const $lastSources = atom<GatewaySource[]>([])
+import { $botSections, $draggingBot } from './user-sections'
+import { useEscapeCancelsBotDrag } from './user-sections-ui'
// ── roster pane ──────────────────────────────────────────────────────────────
@@@ -409,31 -585,177 +414,35 @@@ export function BotsPane()
)
const renderGroupRow = (row: { members: GroupMember[]; name: string }) => (
- <GroupRow
- <div className="grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center" key={`group:${row.name}`}>
- <GroupRow
- active={groupChatName === row.name}
- group={row.name}
- members={row.members}
- needsYou={Boolean(groupNeedsYou[row.name])}
- onDisband={setDeletingGroup}
- onOpen={openGroupChat}
- />
- <div className="flex flex-col">
- {([-1, 1] as const).map(delta => (
- <Tip key={delta} label={delta === -1 ? b.sections.moveUp : b.sections.moveDown}>
- <Button
- aria-label={`${row.name}: ${delta === -1 ? b.sections.moveUp : b.sections.moveDown}`}
- disabled={!reorderGroupRows(sortedGroupRows, row.name, delta)}
- onClick={() => moveRoom(row.name, delta)}
- size="icon-xs"
- variant="ghost"
- >
- <Codicon name={delta === -1 ? 'chevron-up' : 'chevron-down'} />
- </Button>
- </Tip>
- ))}
- </div>
- </div>
++ <RosterGroupRowView
+ active={groupChatName === row.name}
++ b={b}
+ group={row.name}
++ groupClarify={groupClarify}
++ groupNeedsYou={groupNeedsYou}
++ groupRooms={groupRooms}
+ key={`group:${row.name}`}
+ members={row.members}
- needsYou={Boolean(groupNeedsYou[row.name]) || groupHasPendingClarify(groupClarify, row.name)}
+ onDisband={setDeletingGroup}
+ onOpen={openGroupChat}
++ sortedGroupRows={sortedGroupRows}
+ />
)
- const removeSection = (id: string) => {
- const name = userSections.find(section => section.id === id)?.name || ''
- const { members, undo } = deleteBotSection(id, roster)
-
- // No confirmation: nothing is lost (the bots fall back to Unassigned) and
- // the toast's Undo puts the section and its members back.
- host.notify({
- action: { label: b.sections.undo, onClick: undo },
- durationMs: 8_000,
- kind: 'info',
- message: b.sections.deleted(name, members.length)
+ const { renderUserSections, renderGatewaySection, renderGroupChatSection, renderHiddenGatewaySection } =
+ rosterSectionRenderers({
+ b,
+ userSections,
+ roster,
+ allMeta,
+ dragging,
+ rosterSectionCollapsed,
+ toggleRosterSection,
+ setSectionDialog,
+ renderBotRow,
+ renderGroupRow,
+ sortedGroupRows
})
- }
-
- // USER SECTIONS — composed with the gateway sections, not instead of them.
- // The gateway headings own the top level whenever the roster shows more
- // than one connection (that axis answers "where does this run", which no
- // folder name can, and a bot's membership lives in its profile on THAT
- // gateway); user sections group the rows INSIDE each connection bucket,
- // indented under it, and group the flat list when there is only one.
- // `keyPrefix` keeps row keys unique across the gateway buckets.
- type UserSectionRow = { bot: RosterRow; kind?: 'bot' } | RosterGroupRow
-
- const renderUserSections = (rows: UserSectionRow[], keyPrefix = '') => {
- // No sections made: the plain list, exactly as before this feature.
- if (!userSections.length) {
- return rows.map(row => (row.kind === 'group' ? renderGroupRow(row) : renderBotRow(row.bot, keyPrefix)))
- }
-
- const nested = Boolean(keyPrefix)
- const blocks = groupRowsBySection(rows, userSections, allMeta)
-
- return (
- blocks
- // An empty Unassigned is not worth a heading; an empty NAMED section
- // is, because it is somewhere the user made and is about to drop into.
- // Inside a gateway bucket the same empty section would repeat under
- // every connection, so there it only appears while a drag is in flight
- // (as the drop target it exists for); the row menu files into it
- // regardless.
- .filter(block => block.rows.length || (block.id && (!nested || dragging)))
- .map(block => {
- const key = `${keyPrefix}${block.id ? `user-section:${block.id}` : UNASSIGNED_SECTION_KEY}`
- const collapsed = rosterSectionCollapsed(key)
- const order = userSections.findIndex(section => section.id === block.id)
-
- return (
- <SectionDropZone
- isSource={
- Boolean(dragging) && block.rows.some(row => row.kind !== 'group' && botRosterKey(row.bot) === dragging)
- }
- key={key}
- nested={nested}
- onDropBot={rosterKey => {
- const bot = roster.find(row => botRosterKey(row) === rosterKey)
-
- // `block.id` is null for Unassigned, which is exactly the value
- // moveBotsToSection wants for "clear the assignment".
- if (bot) {
- void moveBotsToSection([bot], block.id)
- }
- }}
- >
- <UserSectionHeader
- canMoveDown={order >= 0 && order < userSections.length - 1}
- canMoveUp={order > 0}
- collapsed={collapsed}
- count={block.rows.length}
- id={block.id}
- name={block.name}
- onDelete={() => block.id && removeSection(block.id)}
- onMove={delta => block.id && moveBotSection(block.id, delta)}
- onRename={() => block.id && setSectionDialog({ id: block.id, mode: 'rename', name: block.name })}
- onToggle={() => toggleRosterSection(key)}
- />
- {collapsed ? null : block.rows.length ? (
- <div className="grid min-w-0 gap-0.5">
- {block.rows.map(row =>
- row.kind === 'group' ? renderGroupRow(row) : renderBotRow(row.bot, `${key}:`)
- )}
- </div>
- ) : (
- // Empty section: a quiet dashed slot that says what it is for,
- // and doubles as a roomy drop target.
- <div className="mx-1 mb-1 rounded-md border border-dashed border-(--ui-stroke-secondary) px-2 py-2 text-center text-[0.6875rem] text-(--ui-text-quaternary)">
- {b.sections.emptyHint}
- </div>
- )}
- </SectionDropZone>
- )
- })
- )
- }
-
- const renderGatewaySection = (section: ResolvedRosterGatewaySection) => {
- const sectionId = `gateway:${section.id}`
- const collapsed = rosterSectionCollapsed(sectionId)
-
- return (
- <div className="min-w-0" key={sectionId}>
- <GatewaySectionHeading
- collapsed={collapsed}
- count={section.rows.length}
- onToggle={() => toggleRosterSection(sectionId)}
- option={section.option}
- />
- {collapsed ? null : (
- <div className="grid min-w-0 gap-0.5">{renderUserSections(section.rows, `${section.id}:`)}</div>
- )}
- </div>
- )
- }
-
- const renderGroupChatSection = () => {
- const sectionId = 'group-chats'
- const collapsed = rosterSectionCollapsed(sectionId)
-
- return (
- <div className="min-w-0" key={sectionId}>
- <RosterSectionHeader
- collapsed={collapsed}
- count={sortedGroupRows.length}
- icon="organization"
- label={b.roster.groupChats}
- onToggle={() => toggleRosterSection(sectionId)}
- tip={`${sortedGroupRows.length} global group chat${sortedGroupRows.length === 1 ? '' : 's'}`}
- />
- {collapsed ? null : <div className="grid min-w-0 gap-0.5">{sortedGroupRows.map(renderGroupRow)}</div>}
- </div>
- )
- }
-
- const renderHiddenGatewaySection = (section: ResolvedRosterGatewaySection) => (
- <div className="min-w-0" key={`hidden-gateway:${section.id}`}>
- <div className="flex min-w-0 items-center gap-1.5 px-2 py-1 text-[0.625rem] font-semibold uppercase tracking-wider text-(--ui-text-quaternary)">
- <GatewayKindGlyph kind={section.option?.kind} />
- <span className="min-w-0 flex-1 truncate">
- {section.option?.label || section.option?.connectionId || 'Current gateway'}
- </span>
- <span className="shrink-0 font-normal tabular-nums">{section.rows.length}</span>
- </div>
- {section.rows.map(row => renderBotRow(row.bot, `hidden:${section.id}:`))}
- </div>
- )
return (
<div className="flex h-full flex-col">