Skip to content

🤯 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.

✨ feat(home): fold the team board's attention list to a slim rail (#22735)

Arvin Xub75b3bfb4eaf
diff --git a/locales/en-US/home.json b/locales/en-US/home.json
index 3cd92faccb4..9159d60fa7a 100644
--- a/locales/en-US/home.json
+++ b/locales/en-US/home.json
@@ -192,6 +192,8 @@
"team.agent.untitled": "Untitled agent",
"team.attention.approvalNeeded": "Waiting for approval to continue",
"team.attention.blocked": "Waiting on teammates",
+ "team.attention.collapse": "Collapse",
+ "team.attention.expand": "Show runs that need attention",
"team.attention.failed": "Failed",
"team.attention.failedAgo": "Failed {{time}} ago",
"team.attention.handle": "Review",
diff --git a/locales/zh-CN/home.json b/locales/zh-CN/home.json
index 494db7b5ad1..21bd9ed7942 100644
--- a/locales/zh-CN/home.json
+++ b/locales/zh-CN/home.json
@@ -192,6 +192,8 @@
"team.agent.untitled": "未命名助手",
"team.attention.approvalNeeded": "需要批准后才能继续",
"team.attention.blocked": "等待团队成员",
+ "team.attention.collapse": "收起",
+ "team.attention.expand": "展开待关注的运行",
"team.attention.failed": "失败",
"team.attention.failedAgo": "{{time}}前失败",
"team.attention.handle": "去处理",
diff --git a/packages/locales/src/default/home.ts b/packages/locales/src/default/home.ts
index 3062f6c7769..f279e80d439 100644
--- a/packages/locales/src/default/home.ts
+++ b/packages/locales/src/default/home.ts
@@ -199,6 +199,8 @@ export default {
'team.agent.untitled': 'Untitled agent',
'team.attention.approvalNeeded': 'Waiting for approval to continue',
'team.attention.blocked': 'Waiting on teammates',
+ 'team.attention.collapse': 'Collapse',
+ 'team.attention.expand': 'Show runs that need attention',
'team.attention.failed': 'Failed',
'team.attention.failedAgo': 'Failed {{time}} ago',
'team.attention.handle': 'Review',
diff --git a/src/features/HomeTeamBoard/AttentionList.tsx b/src/features/HomeTeamBoard/AttentionList.tsx
index 79cbc634ad9..4f3829c8025 100644
--- a/src/features/HomeTeamBoard/AttentionList.tsx
+++ b/src/features/HomeTeamBoard/AttentionList.tsx
@@ -1,11 +1,15 @@
import type { AgentRunBoardAttentionItem } from '@lobechat/types';
-import { Flexbox, Text } from '@lobehub/ui';
+import { ActionIcon, Flexbox, Icon, Text, Tooltip } from '@lobehub/ui';
import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
import * as stylex from '@stylexjs/stylex';
+import { PanelRightCloseIcon, PanelRightOpenIcon } from 'lucide-react';
+import type { ReactNode } from 'react';
import { useTranslation } from 'react-i18next';
import AgentAvatar from '@/components/AgentAvatar';
import AuthorChip from '@/features/HomeInbox/AuthorChip';
+import { useGlobalStore } from '@/store/global';
+import { systemStatusSelectors } from '@/store/global/selectors';
import { sx } from '@/styles/sx';
import { formatDuration } from './layout';
@@ -30,6 +34,37 @@ const styles = stylex.create({
paddingInline: 16,
},
count: { color: cssVar.colorTextTertiary, fontSize: 12 },
+ // Folded: a slim column that still says how much is waiting, so putting the
+ // list away never hides that something is stuck.
+ rail: {
+ alignItems: 'center',
+ backgroundColor: { 'default': cssVar.colorBgContainer, ':hover': cssVar.colorFillQuaternary },
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: 12,
+ borderStyle: 'solid',
+ borderWidth: 1,
+ color: cssVar.colorTextSecondary,
+ cursor: 'pointer',
+ // Below the board's breakpoint the list wraps under the timeline, so
+ // folding saves no width there: the full card shows instead.
+ display: { 'default': 'flex', '@media (max-width: 1100px)': 'none' },
+ flexDirection: 'column',
+ gap: 12,
+ paddingBlock: 12,
+ paddingInline: 0,
+ width: '100%',
+ },
+ // Same breakpoint as the board's grid in `index.tsx`.
+ narrowOnly: { display: { 'default': 'none', '@media (max-width: 1100px)': 'block' } },
+ wideOnly: { display: { 'default': 'inline-flex', '@media (max-width: 1100px)': 'none' } },
+ railCount: {
+ alignItems: 'center',
+ display: 'flex',
+ flexDirection: 'column',
+ fontSize: 12,
+ fontVariantNumeric: 'tabular-nums',
+ gap: 2,
+ },
detail: {
color: cssVar.colorTextSecondary,
fontSize: 13,
@@ -114,52 +149,106 @@ const Item = ({ item, now }: { item: AgentRunBoardAttentionItem; now: Date }) =>
};
const Section = ({
+ action,
items,
now,
title,
}: {
+ action?: ReactNode;
items: AgentRunBoardAttentionItem[];
now: Date;
title: string;
-}) => {
- if (items.length === 0) return null;
-
- return (
- <Flexbox gap={4}>
- <Flexbox horizontal gap={6}>
- <span {...stylex.props(styles.heading)}>{title}</span>
- <span {...stylex.props(styles.count)}>{items.length}</span>
- </Flexbox>
- {items.map((item) => (
- <Item item={item} key={item.operationId} now={now} />
- ))}
+}) => (
+ <Flexbox gap={4}>
+ <Flexbox horizontal align={'center'} gap={6}>
+ <span {...stylex.props(styles.heading)}>{title}</span>
+ <span {...stylex.props(styles.count)}>{items.length}</span>
+ {action && <div style={{ marginInlineStart: 'auto' }}>{action}</div>}
</Flexbox>
- );
-};
+ {items.map((item) => (
+ <Item item={item} key={item.operationId} now={now} />
+ ))}
+ </Flexbox>
+);
const AttentionList = ({ items, now }: { items: AgentRunBoardAttentionItem[]; now: Date }) => {
const { t } = useTranslation('home');
+ const collapsed = useGlobalStore(systemStatusSelectors.teamBoardAttentionCollapsed);
+ const updateSystemStatus = useGlobalStore((s) => s.updateSystemStatus);
+ const setCollapsed = (next: boolean) =>
+ updateSystemStatus({ teamBoardAttentionCollapsed: next }, 'toggleTeamBoardAttention');
+
const waiting = items.filter((item) => item.kind === 'needs_human');
+ const failed = items.filter((item) => item.kind === 'failed');
- return (
+ const sections = [
+ { items: waiting.filter((item) => item.isMine), title: t('team.attention.needsYou') },
+ { items: waiting.filter((item) => !item.isMine), title: t('team.attention.blocked') },
+ { items: failed, title: t('team.attention.failed') },
+ ].filter((section) => section.items.length > 0);
+
+ const card = (
<Flexbox gap={16} {...stylex.props(styles.card)} data-testid={'team-board-attention'}>
- <Section
- items={waiting.filter((item) => item.isMine)}
- now={now}
- title={t('team.attention.needsYou')}
- />
- <Section
- items={waiting.filter((item) => !item.isMine)}
- now={now}
- title={t('team.attention.blocked')}
- />
- <Section
- items={items.filter((item) => item.kind === 'failed')}
- now={now}
- title={t('team.attention.failed')}
- />
+ {sections.map((section, index) => (
+ <Section
+ items={section.items}
+ key={section.title}
+ now={now}
+ title={section.title}
+ action={
+ // The fold control rides on the first heading instead of adding a header row.
+ index === 0 && (
+ <span {...stylex.props(styles.wideOnly)}>
+ <ActionIcon
+ data-testid={'team-board-attention-collapse'}
+ icon={PanelRightCloseIcon}
+ size={'small'}
+ title={t('team.attention.collapse')}
+ onClick={() => setCollapsed(true)}
+ />
+ </span>
+ )
+ }
+ />
+ ))}
</Flexbox>
);
+
+ if (!collapsed) return card;
+
+ const counts = [
+ { count: waiting.length, status: 'needs_human' as const },
+ { count: failed.length, status: 'failed' as const },
+ ].filter(({ count }) => count > 0);
+
+ // Both render; CSS picks one by width, so a fold made on a wide screen
+ // never hides the list on a narrow one.
+ return (
+ <>
+ <Tooltip placement={'left'} title={t('team.attention.expand')}>
+ <button
+ aria-label={t('team.attention.expand')}
+ data-testid={'team-board-attention-rail'}
+ type={'button'}
+ {...stylex.props(styles.rail)}
+ onClick={() => setCollapsed(false)}
+ >
+ <Icon icon={PanelRightOpenIcon} size={16} />
+ {counts.map(({ count, status }) => (
+ <span
+ data-testid={`team-board-attention-rail-${status}`}
+ key={status}
+ {...sx(styles.railCount, { color: RUN_STATUS_VISUALS[status].color })}
+ >
+ <Icon icon={RUN_STATUS_VISUALS[status].icon} size={14} />
+ {count}
+ </span>
+ ))}
+ </button>
+ </Tooltip>
+ <div {...stylex.props(styles.narrowOnly)}>{card}</div>
+ </>
+ );
};
export default AttentionList;
diff --git a/src/features/HomeTeamBoard/index.tsx b/src/features/HomeTeamBoard/index.tsx
index 9926a14e350..e0a934af06a 100644
--- a/src/features/HomeTeamBoard/index.tsx
+++ b/src/features/HomeTeamBoard/index.tsx
@@ -9,6 +9,8 @@ import AsyncError from '@/components/AsyncError';
import { useClientPollingSWR } from '@/libs/swr';
import { useCacheScope } from '@/libs/swr/useCacheScope';
import { agentRunBoardService } from '@/services/agentRunBoard';
+import { useGlobalStore } from '@/store/global';
+import { systemStatusSelectors } from '@/store/global/selectors';
import ActivityPanel from './ActivityPanel';
import AttentionList from './AttentionList';
@@ -32,6 +34,12 @@ const styles = stylex.create({
},
alignItems: 'start',
},
+ columnsFolded: {
+ gridTemplateColumns: {
+ 'default': 'minmax(0, 1fr) 44px',
+ '@media (max-width: 1100px)': 'minmax(0, 1fr)',
+ },
+ },
columnsFull: { gridTemplateColumns: 'minmax(0, 1fr)' },
empty: {
borderColor: cssVar.colorBorderSecondary,
@@ -53,6 +61,7 @@ const HomeTeamBoard = () => {
const [scope, setScope] = useState<AgentRunBoardScope>('all');
const [agentId, setAgentId] = useState<string>();
const [userId, setUserId] = useState<string>();
+ const attentionCollapsed = useGlobalStore(systemStatusSelectors.teamBoardAttentionCollapsed);
// The options depend on the scope and window, so a pick may not exist in the next one.
const clearPicks = () => {
@@ -123,7 +132,13 @@ const HomeTeamBoard = () => {
onAgentChange={setAgentId}
onUserChange={setUserId}
/>
- <div {...stylex.props(styles.columns, !hasAttention && styles.columnsFull)}>
+ <div
+ {...stylex.props(
+ styles.columns,
+ attentionCollapsed && styles.columnsFolded,
+ !hasAttention && styles.columnsFull,
+ )}
+ >
{!data.lanes?.length ? (
<div {...stylex.props(styles.empty)}>
{t(scope === 'involved' ? 'team.emptyInvolved' : 'team.empty', {
diff --git a/src/store/global/initialState.ts b/src/store/global/initialState.ts
index 1a473769a24..f323257f8ee 100644
--- a/src/store/global/initialState.ts
+++ b/src/store/global/initialState.ts
@@ -489,6 +489,11 @@ export interface SystemStatus {
showSubTasks: boolean;
subGroupBy: 'assignee' | 'member' | 'none' | 'priority' | 'status' | `label:${string}`;
};
+ /**
+ * Home team board: the attention list folded to a slim rail so the timeline
+ * gets the width. Persisted, like the other folded panels.
+ */
+ teamBoardAttentionCollapsed?: boolean;
/**
* Height of the chat bottom terminal panel. Persisted so resizing survives remounts.
*/
diff --git a/src/store/global/selectors/systemStatus.test.ts b/src/store/global/selectors/systemStatus.test.ts
index ab94f5e158b..8f5d3b54f5e 100644
--- a/src/store/global/selectors/systemStatus.test.ts
+++ b/src/store/global/selectors/systemStatus.test.ts
@@ -813,6 +813,23 @@ describe('systemStatusSelectors', () => {
});
});
+ describe('teamBoardAttentionCollapsed', () => {
+ // Open by default: a first-time viewer must see what needs attention.
+ it('reads as open when the viewer has never folded the list', () => {
+ const s: GlobalState = merge(initialState, { status: {} });
+
+ expect(systemStatusSelectors.teamBoardAttentionCollapsed(s)).toBe(false);
+ });
+
+ it('keeps the list folded once the viewer put it away', () => {
+ const s: GlobalState = merge(initialState, {
+ status: { teamBoardAttentionCollapsed: true },
+ });
+
+ expect(systemStatusSelectors.teamBoardAttentionCollapsed(s)).toBe(true);
+ });
+ });
+
describe('homeGoalsCollapsed', () => {
// The goals card opens by default: a first-time viewer must see the goals,
// not an unexplained folded header.
diff --git a/src/store/global/selectors/systemStatus.ts b/src/store/global/selectors/systemStatus.ts
index fcd9f687c0b..49526bb86b1 100644
--- a/src/store/global/selectors/systemStatus.ts
+++ b/src/store/global/selectors/systemStatus.ts
@@ -460,6 +460,8 @@ const showHomeRail = (s: GlobalState) => s.status.showHomeRail ?? false;
const showHomePortrait = (s: GlobalState) => s.status.showHomePortrait ?? true;
const hiddenHomeWidgets = (s: GlobalState): string[] => s.status.hiddenHomeWidgets ?? [];
const homeGoalsCollapsed = (s: GlobalState): boolean => s.status.homeGoalsCollapsed ?? false;
+const teamBoardAttentionCollapsed = (s: GlobalState): boolean =>
+ s.status.teamBoardAttentionCollapsed ?? false;
const homeRecentsCount = (s: GlobalState): number => s.status.homeRecentsCount ?? 8;
const homeTaskCount = (s: GlobalState): number => s.status.homeTaskCount ?? 8;
const showRightPanel = (s: GlobalState) => s.status.showRightPanel;
@@ -604,6 +606,7 @@ export const systemStatusSelectors = {
taskListFilter,
taskListFilters,
taskListViewOptions,
+ teamBoardAttentionCollapsed,
sidebarExpandedKeys,
agentSidebarSections,
projectOnboardingDismissed,