From 07d897667dd54e6d93e7281482c6a5aeb782448b Mon Sep 17 00:00:00 2001 From: Lily Shen <115414357+lilyshen0722@users.noreply.github.com> Date: Fri, 4 Sep 2026 21:40:53 -0700 Subject: [PATCH 01/22] feat(v2): rebuild workspace pods sidebar --- frontend/src/i18n/locales/en.json | 9 + frontend/src/i18n/locales/zh-CN.json | 9 + .../V2PodsSidebar.community.test.tsx | 315 ++----- .../v2/__tests__/V2PodsSidebarCreate.test.tsx | 4 +- .../v2/__tests__/v2-layout-invariants.test.ts | 163 ++-- frontend/src/v2/components/V2PodsSidebar.tsx | 880 +++++------------- frontend/src/v2/v2.css | 208 ++++- 7 files changed, 583 insertions(+), 1005 deletions(-) diff --git a/frontend/src/i18n/locales/en.json b/frontend/src/i18n/locales/en.json index a95f156ed1..dad1e2bf2a 100644 --- a/frontend/src/i18n/locales/en.json +++ b/frontend/src/i18n/locales/en.json @@ -1497,6 +1497,15 @@ "title": "Join Commonly HQ", "copy": "Meet the builders and their agents.", "button": "Join HQ" + }, + "workspace": { + "rooms": "rooms", + "channels": "channels", + "direct": "direct", + "new": "new", + "connect": "Connect {{platform}}", + "untitled": "Untitled pod", + "needsYouCount": "{{count}} needs you" } }, "feedbackMenu": { diff --git a/frontend/src/i18n/locales/zh-CN.json b/frontend/src/i18n/locales/zh-CN.json index 46266e0c0d..de222b0319 100644 --- a/frontend/src/i18n/locales/zh-CN.json +++ b/frontend/src/i18n/locales/zh-CN.json @@ -1491,6 +1491,15 @@ "title": "加入 Commonly HQ", "copy": "结识开发者和他们的智能体。", "button": "加入 HQ" + }, + "workspace": { + "rooms": "房间", + "channels": "频道", + "direct": "私信", + "new": "新建", + "connect": "连接 {{platform}}", + "untitled": "未命名 Pod", + "needsYouCount": "{{count}} 项待处理" } }, "feedbackMenu": { diff --git a/frontend/src/v2/__tests__/V2PodsSidebar.community.test.tsx b/frontend/src/v2/__tests__/V2PodsSidebar.community.test.tsx index 6b776da248..ce9c8bfa46 100644 --- a/frontend/src/v2/__tests__/V2PodsSidebar.community.test.tsx +++ b/frontend/src/v2/__tests__/V2PodsSidebar.community.test.tsx @@ -1,285 +1,114 @@ // @ts-nocheck import React from 'react'; -import { act, fireEvent, render, screen, waitFor } from '@testing-library/react'; +import { + act, fireEvent, render, screen, within, +} from '@testing-library/react'; import { MemoryRouter, useLocation } from 'react-router-dom'; import i18n, { i18nReady } from '../../i18n'; import V2PodsSidebar from '../components/V2PodsSidebar'; -const COMMUNITY_POD_ID = 'community-pod'; -const mockJoinPod = jest.fn(); -const mockSeedFromExisting = jest.fn(); -const mockRefresh = jest.fn(); const mockApiGet = jest.fn(); -const mockApi = { - get: mockApiGet, - post: jest.fn(), - patch: jest.fn(), - del: jest.fn(), -}; +const mockCreatePod = jest.fn(); jest.mock('../hooks/useV2Pods', () => ({ useV2Pods: () => ({ - pods: [], - loading: false, - error: null, - refresh: mockRefresh, - createPod: jest.fn(), - deletePod: jest.fn(), - patchLastMessage: jest.fn(), - }), -})); - -jest.mock('../hooks/useV2Pinned', () => ({ - useV2Pinned: () => ({ - pinned: new Set(), - toggle: jest.fn(), - isPinned: () => false, + pods: [], loading: false, error: null, createPod: mockCreatePod, patchLastMessage: jest.fn(), }), })); jest.mock('../hooks/useV2Api', () => ({ - useV2Api: () => mockApi, -})); - -jest.mock('../hooks/useV2Unread', () => ({ - useV2Unread: () => ({ - isUnread: () => false, - bumpLatest: jest.fn(), - seedFromExisting: mockSeedFromExisting, - }), -})); - -jest.mock('../../context/SocketContext', () => ({ - useSocket: () => ({ socket: null, connected: false, joinPod: mockJoinPod }), + useV2Api: () => ({ get: mockApiGet, post: jest.fn(), patch: jest.fn(), del: jest.fn() }), })); jest.mock('../../context/AuthContext', () => ({ - useAuth: () => ({ currentUser: { _id: 'human-1', username: 'new-human' } }), + useAuth: () => ({ currentUser: { _id: 'me', username: 'me' } }), })); const CurrentPath = () =>