Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

refactor: 统一筛选提醒点并在 DESIGN.md 登记

Dash249fdfacd0dd
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/ConversationSearchBox.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/ConversationSearchBox.tsx
index dfd85c876a..efd39ec9a8 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/ConversationSearchBox.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/ConversationSearchBox.tsx
@@ -66,6 +66,7 @@ import type {
import { conversationSearchTitle } from '../../../../shared/conversationSearch';
import { highlightSegments } from '../lib/highlightSegments';
import { keywordRanges } from './keywordRanges';
+import { FilterReminderDot } from './FilterReminderDot';
import { resolveSessionRoute } from '@/lib/orcaSessionIdentity';
import { remoteProjectsStore } from '@/features/device-link/remoteProjectsStore';
import { conversationSearchResultKey } from '@/lib/conversationSearchFanout';
@@ -975,12 +976,7 @@ export function SearchFilterMenu({
>
<SlidersHorizontal size={compact ? 14 : 13} className="shrink-0" />
{compact ? (
- activeCount > 0 && (
- <span
- aria-hidden
- className="absolute -right-0.5 -top-0.5 size-1.5 rounded-full bg-[var(--status-bar-accent)]"
- />
- )
+ activeCount > 0 && <FilterReminderDot />
) : (
<>
<span className="truncate">
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/FilterReminderDot.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/FilterReminderDot.tsx
new file mode 100644
index 0000000000..445469a649
--- /dev/null
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/FilterReminderDot.tsx
@@ -0,0 +1,15 @@
+/**
+ * FilterReminderDot —— 筛选提醒点(DESIGN.md「筛选提醒点」,2026-10-20 登记)。
+ * 6px 强调色小圆点,落在筛选 / 视图设置按钮的右上角,提醒「当前列表不是默认的进行中视图」:
+ * 搜索框旁的筛选按钮有筛选条件生效时、整理侧边栏按钮在查看「已归档」时都用它,
+ * 位置 / 大小 / 颜色只此一处,不要在调用方另写一份。
+ * 纯装饰:状态由按钮的 aria-label 播报。宿主按钮须带 `relative`。
+ */
+export function FilterReminderDot() {
+ return (
+ <span
+ aria-hidden
+ className="absolute -right-0.5 -top-0.5 size-1.5 rounded-full bg-[var(--status-bar-accent)]"
+ />
+ );
+}
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarFilterPopover.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarFilterPopover.tsx
index a904fb2885..703eae769d 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarFilterPopover.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarFilterPopover.tsx
@@ -90,6 +90,7 @@ import { DIALOGUE_FILTER_KEY, projectFilterIncludes } from '../hooks/helpers/sid
import { DEFAULT_TASK_INFO_FIELDS } from '../hooks/helpers/sidebarFilterCore';
import { useTaskInfoFields, type TaskInfoField } from '../hooks/useTaskInfoFields';
import { MENU_ITEM_CLASS, MENU_ROW_CLASS } from './menuStyles';
+import { FilterReminderDot } from './FilterReminderDot';
type Option<T extends string> = {
value: T;
@@ -582,14 +583,9 @@ export function SidebarFilterPopover({
)}
>
<SlidersHorizontal size={14} strokeWidth={2} />
- {/* 正在看已归档任务时标一个点(与搜索筛选按钮同款),提醒列表
- 不是平常的进行中任务;段头会让这个按钮常驻显示。 */}
- {status === 'archived' && (
- <span
- aria-hidden
- className="absolute right-1 top-1 size-1.5 rounded-full bg-[var(--status-bar-accent)]"
- />
- )}
+ {/* 正在看已归档任务时标一个点,提醒列表不是平常的进行中任务;
+ 段头会让这个按钮常驻显示。 */}
+ {status === 'archived' && <FilterReminderDot />}
</button>
</Tip>
)}
diff --git a/apps/mobile/src/__tests__/HomeSearchBar.test.tsx b/apps/mobile/src/__tests__/HomeSearchBar.test.tsx
new file mode 100644
index 0000000000..09b072f4e0
--- /dev/null
+++ b/apps/mobile/src/__tests__/HomeSearchBar.test.tsx
@@ -0,0 +1,40 @@
+// @vitest-environment jsdom
+import { act, createElement as el } from 'react';
+import { createRoot, type Root } from 'react-dom/client';
+import { afterEach, beforeEach, expect, it, vi } from 'vitest';
+
+vi.mock('react-native', () => ({
+ StyleSheet: { create: (value: unknown) => value },
+ Pressable: ({ children, accessibilityLabel, testID }: any) => el('button', { 'aria-label': accessibilityLabel, 'data-testid': testID }, typeof children === 'function' ? children({ pressed: false }) : children),
+ View: ({ children, testID }: any) => el('div', { 'data-testid': testID }, children),
+}));
+vi.mock('lucide-react-native', () => ({ Search: () => null, SlidersHorizontal: () => null, X: () => null }));
+vi.mock('react-i18next', () => ({ useTranslation: () => ({ t: (key: string) => key }) }));
+vi.mock('@/components/AppText', () => ({ TextInput: () => null }));
+vi.mock('@/components/mobileInteractionStyles', () => ({ mobileInteractionStyles: {} }));
+vi.mock('@/components/FilterReminderDot', () => ({ FilterReminderDot: () => el('i', { 'data-testid': 'filter-dot' }) }));
+vi.mock('@/platform/chrome', () => ({ NativePullDownMenu: ({ children }: any) => children }));
+vi.mock('@/theme', async () => {
+ const { lightColors } = await import('@/theme/tokens');
+ return { useTheme: () => ({ colors: lightColors }), useThemedStyles: (make: (colors: unknown) => unknown) => make(lightColors) };
+});
+import { HomeSearchBar } from '@/session/HomeSearchBar';
+
+let root: Root;
+let node: HTMLDivElement;
+beforeEach(() => {
+ Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true });
+ node = document.createElement('div');
+ root = createRoot(node);
+});
+afterEach(async () => { await act(async () => root.unmount()); });
+
+// 搜索栏筛选钮的提醒点已改用共用的 FilterReminderDot(与首页「⋯」的归档提醒共用):
+// 只有筛选条件生效时才出现在筛选钮内,没有筛选时不出现。
+it.each([[true, 1], [false, 0]])('filterActive=%s shows %s reminder dot(s) on the filter button', async (filterActive, count) => {
+ await act(async () => root.render(el(HomeSearchBar, {
+ autoFocus: false, filterActive, onChangeQuery: vi.fn(), onOpenFilter: vi.fn(), query: '',
+ })));
+ const filterButton = node.querySelector('[data-testid="home.searchFilterButton"]')!;
+ expect(filterButton.querySelectorAll('[data-testid="filter-dot"]')).toHaveLength(count);
+});
diff --git a/apps/mobile/src/components/FilterReminderDot.tsx b/apps/mobile/src/components/FilterReminderDot.tsx
new file mode 100644
index 0000000000..4251d85a7e
--- /dev/null
+++ b/apps/mobile/src/components/FilterReminderDot.tsx
@@ -0,0 +1,25 @@
+import { StyleSheet, View, type StyleProp, type ViewStyle } from "react-native";
+import { useThemedStyles, type ThemeColors } from "@/theme";
+import { radius } from "@/theme/tokens";
+
+/**
+ * 筛选提醒点(DESIGN.md「筛选提醒点」,2026-10-20 登记):6pt 强调色小圆点,落在筛选 / 视图设置
+ * 按钮的右上角,提醒「当前列表不是默认的进行中视图」。搜索栏的筛选钮有筛选条件生效时、首页
+ * 「⋯」显示设置钮在查看「已归档」时共用它;大小与颜色只此一处,调用方只给相对宿主按钮的偏移。
+ * 纯装饰:状态由按钮的无障碍名称 / 状态播报。宿主按钮须是定位容器。
+ */
+export function FilterReminderDot({ offset, testID }: { offset: StyleProp<ViewStyle>; testID?: string }) {
+ const styles = useThemedStyles(makeStyles);
+ return <View pointerEvents="none" style={[styles.dot, offset]} testID={testID} />;
+}
+
+const makeStyles = (colors: ThemeColors) =>
+ StyleSheet.create({
+ dot: {
+ backgroundColor: colors.statusAccent,
+ borderRadius: radius.pill,
+ height: 6,
+ position: "absolute",
+ width: 6,
+ },
+ });
diff --git a/apps/mobile/src/session/HomeSearchBar.tsx b/apps/mobile/src/session/HomeSearchBar.tsx
index 1ce5fd2c49..70646b03ef 100644
--- a/apps/mobile/src/session/HomeSearchBar.tsx
+++ b/apps/mobile/src/session/HomeSearchBar.tsx
@@ -6,6 +6,7 @@ import { Search, SlidersHorizontal, X } from "lucide-react-native";
import { Pressable, StyleSheet, View } from "react-native";
import { useTranslation } from "react-i18next";
import { TextInput } from "@/components/AppText";
+import { FilterReminderDot } from "@/components/FilterReminderDot";
import { mobileInteractionStyles } from "@/components/mobileInteractionStyles";
import {
NativePullDownMenu,
@@ -70,7 +71,7 @@ export function HomeSearchBar({
size={iconSize.md}
strokeWidth={iconStroke.regular}
/>
- {filterActive ? <View style={styles.filterDot} /> : null}
+ {filterActive ? <FilterReminderDot offset={styles.filterDotOffset} /> : null}
</Pressable>
);
return (
@@ -174,14 +175,6 @@ const makeStyles = (colors: ThemeColors) =>
position: "relative",
width: 36,
},
- filterDot: {
- backgroundColor: colors.statusAccent,
- borderRadius: radius.pill,
- height: 6,
- position: "absolute",
- right: 7,
- top: 7,
- width: 6,
- },
+ filterDotOffset: { right: 7, top: 7 },
pressed: mobileInteractionStyles.pressed,
});
diff --git a/apps/mobile/src/session/HomeSurface.tsx b/apps/mobile/src/session/HomeSurface.tsx
index 47cd36009d..7ef32453d1 100644
--- a/apps/mobile/src/session/HomeSurface.tsx
+++ b/apps/mobile/src/session/HomeSurface.tsx
@@ -87,6 +87,7 @@ import { TEAMMATE_COLLECTION_ID } from '@/session/useTeammateRoster';
import { AccountSwitcherSheet } from '@/session/AccountSwitcherSheet';
import { HomeChromeFrost } from '@/session/HomeChromeFrost';
import { HomeGlassMenuPanel, HomeMenuScrim } from '@/session/HomeGlassMenuPanel';
+import { FilterReminderDot } from '@/components/FilterReminderDot';
import { HomeHeaderGlassButton } from '@/session/HomeHeaderGlassButton';
import { useAdaptiveWindow } from '@/platform/AdaptiveWindowContext';
import { useBalancedTitle } from '@/platform/chrome/balancedTitle';
@@ -3270,7 +3271,7 @@ function HomeScreenContent({ active = true, onModeChange, width, newSessionInSys
<View>
<Ellipsis color={colors.textPrimary} size={iconSize.action} strokeWidth={iconStroke.regular} />
{/* 在看已归档任务时标一个点,提醒列表不是平常的进行中任务。 */}
- {archivedReminder ? <View style={styles.displayFilterDot} testID="home.displayFilterDot" /> : null}
+ {archivedReminder ? <FilterReminderDot offset={styles.displayFilterDotOffset} testID="home.displayFilterDot" /> : null}
</View>
</HomeHeaderGlassButton>
</HomeDisplayMenu>
@@ -4967,15 +4968,7 @@ const makeStyles = (colors: ThemeColors) => StyleSheet.create({
headerActionsWide: {
width: navigationChrome.target * 2 + spacing.xs,
},
- displayFilterDot: {
- position: 'absolute',
- top: -1,
- right: -2,
- width: 6,
- height: 6,
- borderRadius: radius.pill,
- backgroundColor: colors.statusAccent,
- },
+ displayFilterDotOffset: { top: -1, right: -2 },
// 菜单外层替标题占住顶栏中间的剩余宽度,长设备名在这里截断而不是挤开右侧按钮。
headerTitleSlot: {
flex: 1,
diff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.md
index 176e228c57..bd3df8cb42 100644
--- a/docs/design-rules/DESIGN.md
+++ b/docs/design-rules/DESIGN.md
@@ -273,7 +273,7 @@ Toast loading is neutral: use the shared 16×16 Spinner in `--text-secondary`, w
The grayscale rule is near-absolute. The following are the **only** sanctioned non-gray colors in the system — each tightly scoped to a specific surface. New semantic colors must not be introduced without being recorded here first.
- **Focus Blue** (`#417CDD` at 50%; tokens `--focus-ring` / `--focus-ring-soft`): the keyboard-accessibility focus ring, finalized 2026-07-17 (replaces Tailwind's default `#3b82f6`). Never visible in normal interaction flow.
-- **Thinking / Warning Orange** (`#EA6B17`, finalized 2026-07-17, replaces the frozen `#FF6600`): the shared warning-accent family, identical in both modes. Sanctioned consumers only — the ChatView Running Status Bar (sparkles icon + status text, e.g. `Spelunking...`, no background fill), running-state breathing icons in the sidebar, the collaboration-mode menu row's ON state, the plan-approve icon, the Full Access permission highlight, the settings integration warning, and the workflow agent status strip's running cells (8×8px filled squares in the background-tasks panel detail and the workflow chat card, registered 2026-07-28 — running-state semantics, same family as the sidebar breathing icons; the done/failed/queued cells stay on their own semantic tokens: `--card-status-done` / `--error-fg` / `--surface-chip`), and the sidebar task-info PR unresolved corner dot (registered 2026-08-17 — same `--status-bar-accent` as the session-header unresolved count; static, no breathing), and the Bot group chat speaking row (registered 2026-09-27 — sparkles icon + status text for the teammate currently taking its turn, the same running semantics and `--status-bar-accent` as the ChatView Running Status Bar; no background fill), and the running step of a Bot group chat 分工 plan card and the group's sidebar 「正在做 / 正在安排」 preview (registered 2026-09-27 — icon + status word of the one step in progress, same running semantics and `--status-bar-accent`; no background fill; done / pending / failed steps stay neutral) (see the §10 exemption table and §15 for the full token list: `--warning-accent` and its follower tokens). A consumer that introduces no new token — one that reads `--warning-accent` or an existing follower directly, like this strip — is registered by this list alone; a consumer needing a NEW token must be registered in the §10 exemption table first.
+- **Thinking / Warning Orange** (`#EA6B17`, finalized 2026-07-17, replaces the frozen `#FF6600`): the shared warning-accent family, identical in both modes. Sanctioned consumers only — the ChatView Running Status Bar (sparkles icon + status text, e.g. `Spelunking...`, no background fill), running-state breathing icons in the sidebar, the collaboration-mode menu row's ON state, the plan-approve icon, the Full Access permission highlight, the settings integration warning, and the workflow agent status strip's running cells (8×8px filled squares in the background-tasks panel detail and the workflow chat card, registered 2026-07-28 — running-state semantics, same family as the sidebar breathing icons; the done/failed/queued cells stay on their own semantic tokens: `--card-status-done` / `--error-fg` / `--surface-chip`), and the sidebar task-info PR unresolved corner dot (registered 2026-08-17 — same `--status-bar-accent` as the session-header unresolved count; static, no breathing), and the filter reminder dot (registered 2026-10-20 — a static 6px/6pt dot at the top-right corner of a filter or view-settings button, meaning "this list is not the default active view": the search filter button while any narrowing filter is applied, and the sidebar organize button / Mobile home `⋯` display-settings button while viewing archived tasks; same `--status-bar-accent` / `statusAccent`, no breathing, no text; Desktop shares one `FilterReminderDot` component and Mobile one `FilterReminderDot` component so size, offset and color live in one place; it is purely visual, so the button's accessible name or state must carry the same information; sort and grouping changes and the "all" status do not light it), and the Bot group chat speaking row (registered 2026-09-27 — sparkles icon + status text for the teammate currently taking its turn, the same running semantics and `--status-bar-accent` as the ChatView Running Status Bar; no background fill), and the running step of a Bot group chat 分工 plan card and the group's sidebar 「正在做 / 正在安排」 preview (registered 2026-09-27 — icon + status word of the one step in progress, same running semantics and `--status-bar-accent`; no background fill; done / pending / failed steps stay neutral) (see the §10 exemption table and §15 for the full token list: `--warning-accent` and its follower tokens). A consumer that introduces no new token — one that reads `--warning-accent` or an existing follower directly, like this strip — is registered by this list alone; a consumer needing a NEW token must be registered in the §10 exemption table first.
> **Additional narrowly-scoped exceptions** (documented in their respective component specs, do NOT generalize as system semantic colors):
>