Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions frontend/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"activity": "Activity",
"community": "Community",
"settings": "Settings",
"connectors": "Connectors"
"connectors": "Connectors",
"needsYou": "Needs you",
"team": "Team"
},
"closePodsList": "Close pods list",
"communityRedirect": {
Expand Down Expand Up @@ -443,7 +445,14 @@
},
"header": {
"agentsWorking_one": "{{count}} agent working",
"agentsWorking_other": "{{count}} agents working"
"agentsWorking_other": "{{count}} agents working",
"members_one": "{{count}} member",
"members_other": "{{count}} members",
"agents_one": "{{count}} agent",
"agents_other": "{{count}} agents",
"boardOpen": "board {{count}} open",
"backToPods": "Back to pods",
"compactMeta": "{{members}} · {{count}} agents"
},
"team": {
"view": "View pod team",
Expand Down Expand Up @@ -1572,7 +1581,13 @@
"new": "new",
"connect": "Connect {{platform}}",
"untitled": "Untitled pod",
"needsYouCount": "{{count}} needs you"
"needsYouCount": "{{count}} needs you",
"listTitle": "Pods",
"search": "Search pods",
"noMatch": "no pods match",
"pinnedTitle": "Pinned",
"recent": "Recent",
"everything": "Everything"
}
},
"feedbackMenu": {
Expand Down
21 changes: 18 additions & 3 deletions frontend/src/i18n/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"activity": "动态",
"community": "社区",
"settings": "设置",
"connectors": "连接器"
"connectors": "连接器",
"needsYou": "待处理",
"team": "团队"
},
"closePodsList": "关闭 Pod 列表",
"communityRedirect": {
Expand Down Expand Up @@ -442,7 +444,14 @@
"recent_other": "最近收到 {{formattedCount}} 次心跳"
},
"header": {
"agentsWorking_other": "{{count}} 个智能体正在工作"
"agentsWorking_other": "{{count}} 个智能体正在工作",
"members_one": "{{count}} 名成员",
"members_other": "{{count}} 名成员",
"agents_one": "{{count}} 个智能体",
"agents_other": "{{count}} 个智能体",
"boardOpen": "看板 {{count}} 项待办",
"backToPods": "返回 Pod 列表",
"compactMeta": "{{members}} · {{count}} 个智能体"
},
"team": {
"view": "查看 Pod 团队",
Expand Down Expand Up @@ -1564,7 +1573,13 @@
"new": "新建",
"connect": "连接 {{platform}}",
"untitled": "未命名 Pod",
"needsYouCount": "{{count}} 项待处理"
"needsYouCount": "{{count}} 项待处理",
"listTitle": "Pod",
"search": "搜索 Pod",
"noMatch": "没有匹配的 Pod",
"pinnedTitle": "置顶",
"recent": "最近",
"everything": "全部"
}
},
"feedbackMenu": {
Expand Down
32 changes: 12 additions & 20 deletions frontend/src/v2/__tests__/V2Composer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,30 +79,22 @@ const renderChat = (detail) => render(
);

describe('V2Composer send button', () => {
test('uses the artboard’s compact working count in the thread header', () => {
test('the pod header carries the direction-C meta (members · agents), not a working count', () => {
const view = renderChat(makeDetail({
pod: { _id: 'p1', name: 'My Workspace', type: 'chat', description: 'Team discussion' },
members: [{ _id: 'u1', username: 'alice', isBot: false }, { _id: 'u2', username: 'bob', isBot: false }],
agents: [{ agentName: 'scout', instanceId: 'default', displayName: 'Scout' }],
}));

expect(view.container.querySelector('.v2-thread__working')).toHaveTextContent('0 agents working');
expect(view.container.querySelector('.v2-thread__working')).not.toHaveClass('v2-thread__working--active');

view.rerender(
<AuthContext.Provider value={authValue}>
<MemoryRouter>
<V2Thread detail={makeDetail({
pod: { _id: 'p1', name: 'My Workspace', type: 'chat', description: 'Team discussion' },
agents: [{
agentName: 'scout', instanceId: 'default', displayName: 'Scout',
lastHeartbeatAt: new Date().toISOString(),
}],
})} />
</MemoryRouter>
</AuthContext.Provider>,
);

expect(view.container.querySelector('.v2-thread__working')).toHaveTextContent('1 agent working');
expect(view.container.querySelector('.v2-thread__working')).toHaveClass('v2-thread__working--active');
const header = view.container.querySelector('.v2-pod-header');
expect(header).toBeTruthy();
expect(header.querySelector('h1')).toHaveTextContent('My Workspace');
expect(header.querySelector('.v2-thread__title p')).toHaveTextContent('Team discussion');
const meta = header.querySelector('.v2-pod-header__meta:not(.v2-pod-header__meta--compact)');
expect(meta).toHaveTextContent('2 members');
expect(meta).toHaveTextContent('1 agent');
expect(header.querySelector('.v2-pod-header__meta--compact')).toHaveTextContent('2 · 1 agents');
expect(view.container.querySelector('.v2-thread__working')).toBeNull();
});

test('clicking the send button sends the drafted text', async () => {
Expand Down
32 changes: 31 additions & 1 deletion frontend/src/v2/__tests__/V2LayoutSelection.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ jest.mock('../../context/AuthContext', () => ({
}));

jest.mock('../components/V2NavRail', () => () => null);
jest.mock('../components/V2PodsSidebar', () => () => null);
jest.mock('../components/V2PodsSidebar', () => ({ variant }: { variant?: string }) => (
<div data-testid="pods-sidebar" data-variant={variant || 'column'} />
));
jest.mock('../components/V2Thread', () => ({ onToggleInspector }: { onToggleInspector?: () => void }) => (
<button type="button" onClick={onToggleInspector}>toggle inspector</button>
));
Expand Down Expand Up @@ -100,6 +102,34 @@ describe('V2Layout default pod selection', () => {
});
});

test('on a phone /v2 is the pods list page: no redirect into a pod, no thread, page-variant sidebar', async () => {
Object.defineProperty(window, 'matchMedia', {
configurable: true,
writable: true,
value: jest.fn((query: string) => ({
matches: query === '(max-width: 760px)',
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
})),
});
localStorage.setItem('v2:lastPodId', 'hq');
renderAutoLayout();
await waitFor(() => expect(screen.getByTestId('pods-sidebar')).toHaveAttribute('data-variant', 'page'));
expect(screen.queryByTestId('current-path')).not.toBeInTheDocument();
expect(screen.queryByRole('button', { name: 'toggle inspector' })).not.toBeInTheDocument();
});

test('opening a pod records it in the visit log that orders the sidebar’s Recent', () => {
render(
<MemoryRouter initialEntries={['/v2/pods/workspace']}>
<Routes>
<Route path="/v2/pods/:podId" element={<V2Layout selectionMode="param" />} />
</Routes>
</MemoryRouter>,
);
expect(Object.keys(JSON.parse(localStorage.getItem('v2:podVisits') || '{}'))).toEqual(['workspace']);
});

test('a phone starts with its inspector sheet closed even when desktop left it open', () => {
const phoneViewport = {
matches: true,
Expand Down
36 changes: 27 additions & 9 deletions frontend/src/v2/__tests__/V2MobileTabs.test.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,44 @@
import React from 'react';
import { fireEvent, render, screen } from '@testing-library/react';
import { act, fireEvent, render, screen } from '@testing-library/react';
import { MemoryRouter, useLocation } from 'react-router-dom';
import i18n, { i18nReady } from '../../i18n';
import V2MobileTabs from '../components/V2MobileTabs';

const Location = () => <output data-testid="location">{useLocation().pathname}</output>;

describe('V2MobileTabs', () => {
test('keeps chat, board, needs-you and settings reachable from the phone shell', () => {
const openInspector = jest.fn();
beforeAll(async () => {
await i18nReady;
await act(async () => { await i18n.changeLanguage('en'); });
});

test('four labelled tiles; the count lives inside the Needs you label; each tile navigates', () => {
render(
<MemoryRouter initialEntries={['/v2/pods/pod-1']}>
<V2MobileTabs podId="pod-1" needsYouCount={2} onOpenInspector={openInspector} />
<V2MobileTabs needsYouCount={3} />
<Location />
</MemoryRouter>,
);

expect(screen.getByText('2')).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: 'Board' }));
expect(screen.getByTestId('location')).toHaveTextContent('/v2/pods/pod-1/board');
fireEvent.click(screen.getByRole('button', { name: 'Needs you' }));
expect(openInspector).toHaveBeenCalledTimes(1);
expect(screen.getAllByRole('button').map((b) => b.textContent)).toEqual(['Pods', 'Needs you · 3', 'Team', 'Settings']);
expect(screen.getByRole('button', { name: 'Pods' })).toHaveAttribute('aria-current', 'page');
fireEvent.click(screen.getByRole('button', { name: 'Needs you · 3' }));
expect(screen.getByTestId('location')).toHaveTextContent('/v2/activity');
fireEvent.click(screen.getByRole('button', { name: 'Team' }));
expect(screen.getByTestId('location')).toHaveTextContent('/v2/agents');
fireEvent.click(screen.getByRole('button', { name: 'Settings' }));
expect(screen.getByTestId('location')).toHaveTextContent('/v2/settings');
fireEvent.click(screen.getByRole('button', { name: 'Pods' }));
expect(screen.getByTestId('location')).toHaveTextContent('/v2');
});

test('at zero the label has no count', () => {
render(
<MemoryRouter initialEntries={['/v2']}>
<V2MobileTabs needsYouCount={0} />
</MemoryRouter>,
);
expect(screen.getByRole('button', { name: 'Needs you' })).toBeInTheDocument();
expect(screen.queryByText(/· 0/)).not.toBeInTheDocument();
});
});
165 changes: 0 additions & 165 deletions frontend/src/v2/__tests__/V2PodsSidebar.community.test.tsx

This file was deleted.

Loading
Loading