🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(topic): show status badges on folded project sub-groups (#21077)
Arvin Xu3dcbb8029e4a
diff --git a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/CollapsedIndicators.tsx b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/CollapsedIndicators.tsxnew file mode 100644index 00000000000..60205028063--- /dev/null+++ b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/CollapsedIndicators.tsx@@ -0,0 +1,184 @@+import { createStaticStyles, cssVar, cx, Flexbox, Icon, Tooltip } from '@lobehub/ui';+import isEqual from 'fast-deep-equal';+import { type LucideIcon } from 'lucide-react';+import { memo, useMemo } from 'react';+import { useTranslation } from 'react-i18next';++import { TOPIC_STATUS_VISUALS } from '@/components/ExecutionStatus';+import RingLoadingIcon from '@/components/RingLoading';+import UnreadDot from '@/components/UnreadDot';+import { useChatStore } from '@/store/chat';+import { operationSelectors } from '@/store/chat/selectors';+import { type ChatTopic } from '@/types/topic';++import {+ getProjectTopicStatusCounts,+ hasProjectTopicStatusCounts,+ type ProjectTopicStatusCounts,+} from './statusCounts';++export const indicatorStyles = createStaticStyles(({ css }) => ({+ statusBadge: css`+ display: inline-flex;+ gap: 2px;+ align-items: center;+ justify-content: center;++ min-width: 20px;+ height: 18px;+ padding-inline: 4px;+ border-radius: 9px;++ font-size: 11px;+ font-weight: 500;+ line-height: 1;+ `,+ statusBadgeError: css`+ color: ${cssVar.colorError};+ background: color-mix(in srgb, ${cssVar.colorError} 14%, transparent);+ `,+ statusBadgeLoading: css`+ color: ${cssVar.colorWarning};+ background: color-mix(in srgb, ${cssVar.colorWarning} 14%, transparent);+ `,+ statusBadgeWaiting: css`+ color: ${cssVar.colorInfo};+ background: color-mix(in srgb, ${cssVar.colorInfo} 14%, transparent);+ `,+ hoverActions: css`+ pointer-events: none;++ overflow: hidden;+ display: inline-flex;+ flex: none;+ align-items: center;++ max-width: 0;++ opacity: 0;++ transition:+ max-width 150ms ${cssVar.motionEaseOut},+ opacity 150ms ${cssVar.motionEaseOut};++ /* Holds up to the grouping menu, the "more" menu and the start "+"+ (3 × 24px). Stays open while one of its menus is, so the popup keeps+ its anchor. */+ &:focus-within,+ &:has([data-popup-open]),+ .accordion-header:hover & {+ pointer-events: auto;+ max-width: 72px;+ opacity: 1;+ }++ /* Touch-only screens have no hover to reveal the actions with, so they+ keep their width there, as before the actions collapsed at rest. */+ @media (hover: none) {+ pointer-events: auto;+ max-width: 72px;+ opacity: 1;+ }+ `,+}));++interface StatusBadgeConfig {+ className: string;+ count: number;+ icon?: LucideIcon;+ label: string;+ loading?: boolean;+}++const CollapsedStatusBadges = memo<{ counts: ProjectTopicStatusCounts }>(({ counts }) => {+ const { t } = useTranslation('topic');++ const items: StatusBadgeConfig[] = [+ {+ className: indicatorStyles.statusBadgeLoading,+ count: counts.loading,+ label: t('projectStatus.loading', { count: counts.loading }),+ loading: true,+ },+ {+ className: indicatorStyles.statusBadgeWaiting,+ count: counts.waitingForHuman,+ icon: TOPIC_STATUS_VISUALS.waitingForHuman.icon,+ label: t('projectStatus.waitingForHuman', { count: counts.waitingForHuman }),+ },+ {+ className: indicatorStyles.statusBadgeError,+ count: counts.failed,+ icon: TOPIC_STATUS_VISUALS.failed.icon,+ label: t('projectStatus.failed', { count: counts.failed }),+ },+ ].filter((item) => item.count > 0);++ if (items.length === 0) return null;++ return (+ <Flexbox horizontal align={'center'} gap={3}>+ {items.map(({ className, count, icon, label, loading }) => (+ <Tooltip key={label} title={label}>+ <span+ aria-label={label}+ className={cx(indicatorStyles.statusBadge, className)}+ role="status"+ >+ {loading ? (+ <RingLoadingIcon+ ringColor={`color-mix(in srgb, ${cssVar.colorWarning} 28%, transparent)`}+ size={11}+ style={{ color: cssVar.colorWarning }}+ />+ ) : (+ icon && <Icon icon={icon} size={{ size: 11, strokeWidth: 2 }} />+ )}+ {count}+ </span>+ </Tooltip>+ ))}+ </Flexbox>+ );+});++CollapsedStatusBadges.displayName = 'CollapsedProjectStatusBadges';++const CollapsedUnreadDot = memo<{ count: number }>(({ count }) => {+ const { t } = useTranslation('topic');+ const label = t('projectStatus.unread', { count });++ return (+ <Tooltip title={label}>+ <UnreadDot label={label} />+ </Tooltip>+ );+});++CollapsedUnreadDot.displayName = 'CollapsedProjectUnreadDot';++/**+ * Status counts (running / awaiting input / failed) and unread replies of a+ * folded group's topics, so a folded row still says how much is going on.+ * Nothing shows while the group is expanded — its topic rows say it already.+ */+export const useCollapsedIndicators = (topics: ChatTopic[], expanded: boolean) => {+ const statusCounts = useChatStore(+ (s) => getProjectTopicStatusCounts(topics, operationSelectors.visiblyRunningTopicIds(s)),+ isEqual,+ );+ const topicIds = useMemo(() => topics.map((topic) => topic.id), [topics]);+ const unreadCount = useChatStore(operationSelectors.unreadCompletedCountForTopics(topicIds));+ const hasStatus = !expanded && hasProjectTopicStatusCounts(statusCounts);+ const hasUnread = !expanded && unreadCount > 0;++ const indicators =+ hasStatus || hasUnread ? (+ <>+ {hasStatus && <CollapsedStatusBadges counts={statusCounts} />}+ {hasUnread && <CollapsedUnreadDot count={unreadCount} />}+ </>+ ) : null;++ return { hasIndicators: hasStatus || hasUnread, indicators };+};diff --git a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.tsx b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.tsxindex d6abbf73313..617ce2e5e93 100644--- a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.tsx+++ b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.tsx@@ -7,7 +7,6 @@ import {AccordionTrigger,ActionIcon,Center,- createStaticStyles,cssVar,cx,type DropdownItem,@@ -16,7 +15,6 @@ import {Icon,Text,toast,- Tooltip,} from '@lobehub/ui';import isEqual from 'fast-deep-equal';import {@@ -25,7 +23,6 @@ import {FolderOpenIcon,ListFilter,LucideCheck,- type LucideIcon,PlusIcon,} from 'lucide-react';import { memo, useCallback, useMemo } from 'react';@@ -34,10 +31,7 @@ import { useTranslation } from 'react-i18next';import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';import Avatar from '@/components/Avatar';-import { TOPIC_STATUS_VISUALS } from '@/components/ExecutionStatus';-import RingLoadingIcon from '@/components/RingLoading';import TailMarquee from '@/components/TailMarquee';-import UnreadDot from '@/components/UnreadDot';import { useCommitWorkingDirectory } from '@/features/ChatInput/ControlBar/useCommitWorkingDirectory';import { AgentDirectoryActions } from '@/features/Projects/WorkingDirectories/AgentDirectoryActions';import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';@@ -48,7 +42,6 @@ import { usePermission } from '@/hooks/usePermission';import { useQueryRoute } from '@/hooks/useQueryRoute';import { useAgentStore } from '@/store/agent';import { useChatStore } from '@/store/chat';-import { operationSelectors } from '@/store/chat/selectors';import { useGlobalStore } from '@/store/global';import { type ProjectTopicSubGroupMode } from '@/store/global/initialState';import { systemStatusSelectors } from '@/store/global/selectors';@@ -61,12 +54,8 @@ import { buildPrefixedAgentRoutePath, parseAgentPathname } from '../../../utils/import { useTopicListScope } from '../../TopicListScope';import { getMergedPullRequestTopics } from '../../utils/mergedPullRequestTopics';import { type GroupItemComponentProps } from '../GroupedAccordion';+import { indicatorStyles, useCollapsedIndicators } from './CollapsedIndicators';import ProjectTopicList from './ProjectTopicList';-import {- getProjectTopicStatusCounts,- hasProjectTopicStatusCounts,- type ProjectTopicStatusCounts,-} from './statusCounts';const PROJECT_GROUP_PREFIX = 'project:';const PROJECT_ID_GROUP_PREFIX = 'project-id:';@@ -74,141 +63,6 @@ const SUB_GROUP_MODES: ProjectTopicSubGroupMode[] = ['none', 'byDevice', 'byTime// A plain folder lives on one machine, so sectioning it by device says nothing.const FOLDER_SUB_GROUP_MODES = SUB_GROUP_MODES.filter((mode) => mode !== 'byDevice');-const styles = createStaticStyles(({ css }) => ({- statusBadge: css`- display: inline-flex;- gap: 2px;- align-items: center;- justify-content: center;-- min-width: 20px;- height: 18px;- padding-inline: 4px;- border-radius: 9px;-- font-size: 11px;- font-weight: 500;- line-height: 1;- `,- statusBadgeError: css`- color: ${cssVar.colorError};- background: color-mix(in srgb, ${cssVar.colorError} 14%, transparent);- `,- statusBadgeLoading: css`- color: ${cssVar.colorWarning};- background: color-mix(in srgb, ${cssVar.colorWarning} 14%, transparent);- `,- statusBadgeWaiting: css`- color: ${cssVar.colorInfo};- background: color-mix(in srgb, ${cssVar.colorInfo} 14%, transparent);- `,- addTopicAction: css`- pointer-events: none;-- overflow: hidden;- display: inline-flex;- flex: none;- align-items: center;-- max-width: 0;-- opacity: 0;-- transition:- max-width 150ms ${cssVar.motionEaseOut},- opacity 150ms ${cssVar.motionEaseOut};-- /* Holds the grouping menu, the "more" menu and the start "+" (3 × 24px).- Stays open while one of its menus is, so the popup keeps its anchor. */- &:focus-within,- &:has([data-popup-open]),- .accordion-header:hover & {- pointer-events: auto;- max-width: 72px;- opacity: 1;- }-- /* Touch-only screens have no hover to reveal the actions with, so they- keep their width there, as before the actions collapsed at rest. */- @media (hover: none) {- pointer-events: auto;- max-width: 72px;- opacity: 1;- }- `,-}));--interface StatusBadgeConfig {- className: string;- count: number;- icon?: LucideIcon;- label: string;- loading?: boolean;-}--const CollapsedStatusBadges = memo<{ counts: ProjectTopicStatusCounts }>(({ counts }) => {- const { t } = useTranslation('topic');-- const items: StatusBadgeConfig[] = [- {- className: styles.statusBadgeLoading,- count: counts.loading,- label: t('projectStatus.loading', { count: counts.loading }),- loading: true,- },- {- className: styles.statusBadgeWaiting,- count: counts.waitingForHuman,- icon: TOPIC_STATUS_VISUALS.waitingForHuman.icon,- label: t('projectStatus.waitingForHuman', { count: counts.waitingForHuman }),- },- {- className: styles.statusBadgeError,- count: counts.failed,- icon: TOPIC_STATUS_VISUALS.failed.icon,- label: t('projectStatus.failed', { count: counts.failed }),- },- ].filter((item) => item.count > 0);-- if (items.length === 0) return null;-- return (- <Flexbox horizontal align={'center'} gap={3}>- {items.map(({ className, count, icon, label, loading }) => (- <Tooltip key={label} title={label}>- <span aria-label={label} className={cx(styles.statusBadge, className)} role="status">- {loading ? (- <RingLoadingIcon- ringColor={`color-mix(in srgb, ${cssVar.colorWarning} 28%, transparent)`}- size={11}- style={{ color: cssVar.colorWarning }}- />- ) : (- icon && <Icon icon={icon} size={{ size: 11, strokeWidth: 2 }} />- )}- {count}- </span>- </Tooltip>- ))}- </Flexbox>- );-});--CollapsedStatusBadges.displayName = 'CollapsedProjectStatusBadges';--const CollapsedUnreadDot = memo<{ count: number }>(({ count }) => {- const { t } = useTranslation('topic');- const label = t('projectStatus.unread', { count });-- return (- <Tooltip title={label}>- <UnreadDot label={label} />- </Tooltip>- );-});--CollapsedUnreadDot.displayName = 'CollapsedProjectUnreadDot';-const GroupItem = memo<GroupItemComponentProps>(({ group, expanded }) => {const { id, title, children } = group;const scope = useTopicListScope();@@ -376,15 +230,10 @@ const GroupItem = memo<GroupItemComponentProps>(({ group, expanded }) => {[activeWorkspaceId, canEditTopic, children, currentUserId, t],);- const statusCounts = useChatStore(- (s) => getProjectTopicStatusCounts(children, operationSelectors.visiblyRunningTopicIds(s)),- isEqual,+ const { hasIndicators: hasCollapsedIndicators, indicators } = useCollapsedIndicators(+ children,+ expanded,);- const childTopicIds = useMemo(() => children.map((topic) => topic.id), [children]);- const unreadCount = useChatStore(operationSelectors.unreadCompletedCountForTopics(childTopicIds));- const hasCollapsedStatus = !expanded && hasProjectTopicStatusCounts(statusCounts);- const hasCollapsedUnread = !expanded && unreadCount > 0;- const hasCollapsedIndicators = hasCollapsedStatus || hasCollapsedUnread;const ProjectFolderIcon = expanded ? FolderOpenIcon : FolderClosedIcon;// Sub-grouping is its own row action: it needs no directory, so it stays// available even when the directory actions below can't render. The buttons@@ -392,9 +241,8 @@ const GroupItem = memo<GroupItemComponentProps>(({ group, expanded }) => {// the full row instead of a gap reserved for invisible actions.const action = (<Flexbox horizontal align={'center'} gap={4}>- {hasCollapsedStatus && <CollapsedStatusBadges counts={statusCounts} />}- {hasCollapsedUnread && <CollapsedUnreadDot count={unreadCount} />}- <span className={styles.addTopicAction}>+ {indicators}+ <span className={indicatorStyles.hoverActions}><DropdownMenu items={subGroupMenuItems}><ActionIconicon={ListFilter}diff --git a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/ProjectTopicList.test.tsx b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/ProjectTopicList.test.tsxnew file mode 100644index 00000000000..79e0e3c2fb9--- /dev/null+++ b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/ProjectTopicList.test.tsx@@ -0,0 +1,94 @@+/**+ * @vitest-environment happy-dom+ */+import { fireEvent, render, screen, waitFor } from '@testing-library/react';+import { describe, expect, it, vi } from 'vitest';++import ProjectTopicList from './ProjectTopicList';++vi.mock('@lobehub/ui', async (importOriginal) => ({+ ...(await importOriginal<object>()),+ ...(await import('~base-ui-stubs')).baseUiStubs,+}));++vi.mock('react-i18next', () => ({+ useTranslation: () => ({+ t: (key: string, options?: { count?: number }) =>+ options?.count === undefined ? key : `${key}:${options.count}`,+ }),+}));++vi.mock('@/components/RingLoading', () => ({ default: () => <span /> }));++vi.mock('@/store/device', () => ({+ deviceSelectors: { deviceList: (s: { devices: unknown[] }) => s.devices },+ useDeviceStore: (selector: (state: object) => unknown) =>+ selector({+ devices: [+ { deviceId: 'device-1', friendlyName: 'MacBook' },+ { deviceId: 'device-2', friendlyName: 'Studio Linux' },+ ],+ useFetchDevices: () => ({}),+ }),+}));++vi.mock('@/store/projectWorkingDirectory', () => ({+ useProjectDirectories: () => [+ { deviceId: 'device-1', id: 'binding-mac' },+ { deviceId: 'device-2', id: 'binding-linux' },+ ],+}));++vi.mock('@/store/user', () => ({+ useUserStore: (selector: (state: object) => unknown) => selector({}),+}));+vi.mock('@/store/user/selectors', () => ({+ preferenceSelectors: { topicSortBy: () => 'updatedAt' },+}));++vi.mock('@/store/chat', () => ({+ useChatStore: (selector: (state: object) => unknown) => selector({}),+}));++vi.mock('@/store/chat/selectors', () => ({+ operationSelectors: {+ unreadCompletedCountForTopics: (ids: string[]) => () =>+ ids.filter((id) => id === 'mac-done').length,+ visiblyRunningTopicIds: () => new Set(['mac-running']),+ },+}));++vi.mock('../../List/Item', () => ({+ default: ({ title }: { title: string }) => <div>{title}</div>,+}));++const topics = [+ { id: 'mac-running', projectWorkingDirectoryId: 'binding-mac', title: 'Mac running' },+ {+ id: 'mac-waiting',+ projectWorkingDirectoryId: 'binding-mac',+ status: 'waitingForHuman',+ title: 'Mac waiting',+ },+ { id: 'mac-done', projectWorkingDirectoryId: 'binding-mac', title: 'Mac done' },+ { id: 'linux-idle', projectWorkingDirectoryId: 'binding-linux', title: 'Linux idle' },+] as any;++describe('ProjectTopicList device sections', () => {+ it('shows a folded device section how many of its topics run, await input or are unread', async () => {+ render(<ProjectTopicList mode={'byDevice'} topics={topics} />);++ // Expanded sections leave the status to their topic rows.+ expect(screen.queryByRole('status')).toBeNull();++ fireEvent.click(screen.getByRole('button', { name: 'MacBook' }));+ fireEvent.click(screen.getByRole('button', { name: 'Studio Linux' }));++ await waitFor(() => expect(screen.queryByText('Mac running')).toBeNull());+ expect(screen.getByRole('status', { name: 'projectStatus.loading:1' })).toBeTruthy();+ expect(screen.getByRole('status', { name: 'projectStatus.waitingForHuman:1' })).toBeTruthy();+ expect(screen.getByRole('status', { name: 'projectStatus.unread:1' })).toBeTruthy();+ // The idle Linux section has nothing to report.+ expect(screen.getAllByRole('status')).toHaveLength(3);+ });+});diff --git a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/ProjectTopicList.tsx b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/ProjectTopicList.tsxindex d2de7e3db37..b2f3fe1d6bd 100644--- a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/ProjectTopicList.tsx+++ b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/ProjectTopicList.tsx@@ -35,6 +35,7 @@ import { type ChatTopic, type GroupedTopic } from '@/types/topic';import TopicItem from '../../List/Item';import { formatTimeGroupId } from '../ByTimeMode/timeGroupTitle';+import { indicatorStyles, useCollapsedIndicators } from './CollapsedIndicators';import {DEVICE_SUB_GROUP_PREFIX,groupProjectTopics,@@ -59,6 +60,78 @@ const renderTopic = (topic: ChatTopic) => (/>);+interface SubGroupItemProps {+ expanded: boolean;+ group: GroupedTopic;+ icon?: Pick<ExecutionStatusVisual, 'color' | 'icon'>;+ onStartInDirectory?: (projectWorkingDirectoryId: string) => void;+ startDirectoryId?: string;+ title: string;+}++const SubGroupItem = memo<SubGroupItemProps>(+ ({ expanded, group, icon, onStartInDirectory, startDirectoryId, title }) => {+ const { t: tProject } = useTranslation('project');+ // A folded section keeps the project row's running / awaiting / failed+ // counts and unread dot, so a device section still says how much it does.+ const { hasIndicators, indicators } = useCollapsedIndicators(group.children, expanded);++ return (+ <AccordionItem value={group.id}>+ <AccordionHeader className={'accordion-header'}>+ {/* Same icon column and gap as the project row, so the section+ title lines up with the project name and the topics below. */}+ <AccordionTrigger style={{ paddingBlock: 2, paddingInline: 4 }}>+ <Flexbox horizontal align="center" gap={8} height={24} style={{ overflow: 'hidden' }}>+ <Center flex={'none'} height={24} width={28}>+ {icon && <Icon color={icon.color} icon={icon.icon} size={{ size: 12 }} />}+ </Center>+ <Text ellipsis fontSize={12} type={'secondary'} weight={500}>+ {title}+ </Text>+ </Flexbox>+ </AccordionTrigger>+ {(startDirectoryId || hasIndicators) && (+ <div+ className={cx(+ 'accordion-action',+ accordionStyles.action,+ accordionStyles.actionBorderless,+ hasIndicators && accordionStyles.actionAlwaysVisible,+ )}+ >+ <Flexbox horizontal align={'center'} gap={4}>+ {indicators}+ {startDirectoryId && (+ <span className={indicatorStyles.hoverActions}>+ <ActionIcon+ icon={PlusIcon}+ size={'small'}+ title={tProject('directories.start')}+ onClick={(e) => {+ e.stopPropagation();+ onStartInDirectory?.(startDirectoryId);+ }}+ />+ </span>+ )}+ </Flexbox>+ </div>+ )}+ </AccordionHeader>+ <AccordionPanel contentStyle={{ padding: 0 }}>+ <Flexbox gap={1} paddingBlock={1}>+ {group.children.map(renderTopic)}+ </Flexbox>+ </AccordionPanel>+ </AccordionItem>+ );+ },+ isEqual,+);++SubGroupItem.displayName = 'ProjectTopicSubGroupItem';+interface ProjectTopicListProps {/** The group's effective sub-group mode (folders never get `byDevice`). */mode: ProjectTopicSubGroupMode;@@ -76,7 +149,6 @@ interface ProjectTopicListProps {const ProjectTopicList = memo<ProjectTopicListProps>((props) => {const { mode, onStartInDirectory, startDirectories, topics } = props;const { t } = useTranslation('topic');- const { t: tProject } = useTranslation('project');const topicSortBy = useUserStore(preferenceSelectors.topicSortBy);const field = topicSortBy === 'createdAt' ? 'createdAt' : 'updatedAt';@@ -173,63 +245,23 @@ const ProjectTopicList = memo<ProjectTopicListProps>((props) => {value={expandedIds}onValueChange={handleExpandedChange}>- {groups.map((group) => {- const icon =- mode === 'byStatus'- ? STATUS_ICON[group.id]- : mode === 'byDevice'- ? { color: cssVar.colorTextTertiary, icon: LaptopIcon }- : undefined;- const startDirectoryId = getStartDirectoryId(group);- return (- <AccordionItem key={group.id} value={group.id}>- <AccordionHeader className={'accordion-header'}>- {/* Same icon column and gap as the project row, so the section- title lines up with the project name and the topics below. */}- <AccordionTrigger style={{ paddingBlock: 2, paddingInline: 4 }}>- <Flexbox- horizontal- align="center"- gap={8}- height={24}- style={{ overflow: 'hidden' }}- >- <Center flex={'none'} height={24} width={28}>- {icon && <Icon color={icon.color} icon={icon.icon} size={{ size: 12 }} />}- </Center>- <Text ellipsis fontSize={12} type={'secondary'} weight={500}>- {getTitle(group)}- </Text>- </Flexbox>- </AccordionTrigger>- {startDirectoryId && (- <div- className={cx(- 'accordion-action',- accordionStyles.action,- accordionStyles.actionBorderless,- )}- >- <ActionIcon- icon={PlusIcon}- size={'small'}- title={tProject('directories.start')}- onClick={(e) => {- e.stopPropagation();- onStartInDirectory?.(startDirectoryId);- }}- />- </div>- )}- </AccordionHeader>- <AccordionPanel contentStyle={{ padding: 0 }}>- <Flexbox gap={1} paddingBlock={1}>- {group.children.map(renderTopic)}- </Flexbox>- </AccordionPanel>- </AccordionItem>- );- })}+ {groups.map((group) => (+ <SubGroupItem+ expanded={!!expandedIds?.includes(group.id)}+ group={group}+ key={group.id}+ startDirectoryId={getStartDirectoryId(group)}+ title={getTitle(group)}+ icon={+ mode === 'byStatus'+ ? STATUS_ICON[group.id]+ : mode === 'byDevice'+ ? { color: cssVar.colorTextTertiary, icon: LaptopIcon }+ : undefined+ }+ onStartInDirectory={onStartInDirectory}+ />+ ))}</AccordionRoot>);}, isEqual);