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。

fix: soften teammate selection across roster states

zqchris68959219b27d
diff --git a/apps/desktop/scripts/fixtures/teammates-section/ui-page.mjs b/apps/desktop/scripts/fixtures/teammates-section/ui-page.mjs
index ed6322daa3..ba92024e1c 100644
--- a/apps/desktop/scripts/fixtures/teammates-section/ui-page.mjs
+++ b/apps/desktop/scripts/fixtures/teammates-section/ui-page.mjs
@@ -29,8 +29,9 @@ export default {
states: {
about: 'Shared solid-dot states in expanded rows and collapsed overflow',
data: { profiles: profiles.slice(0, 5).map((bot, index) => ({ ...bot,
+ lastMessageAt: Date.now() - index * 60_000,
avatar: 'cindy://avatar/preset/cindy', lastMessagePreview: ['Working', 'Waiting', 'Finished', 'New message', 'Error'][index] })),
- remoteBots: [], route: '/bots', unread: { 'mate-3': 1, 'mate-4': 1 },
+ remoteBots: [], route: '/bots/mate-2', unread: { 'mate-3': 1, 'mate-4': 1 },
activities: ['running', 'needs-interaction', 'completed', 'idle', 'error'].map((phase, index) =>
[`chat-${index}`, { sessionId: `chat-${index}`, phase, attention: true, workingPhase: 'processing', startedAtMs: null }]),
},
@@ -80,6 +81,24 @@ export default {
},
},
async check(page, ui) {
+ // Read the painted selection, including the wrapper used by local/Cindy rows.
+ const selectedRow = page.locator('[data-sidebar-section="teammates"] [aria-current="page"]').first();
+ if (await selectedRow.count()) {
+ const colors = await selectedRow.evaluate(node => {
+ const surface = node.closest('.bg-sidebar-item-active');
+ const probe = document.createElement('span');
+ probe.style.backgroundColor = 'hsl(var(--surface-hover-hsl))';
+ probe.style.color = 'var(--sidebar-nav-text)';
+ node.append(probe);
+ const expected = getComputedStyle(probe);
+ const actual = getComputedStyle(surface);
+ const result = { background: actual.backgroundColor, foreground: actual.color,
+ expectedBackground: expected.backgroundColor, expectedForeground: expected.color };
+ probe.remove(); return result;
+ });
+ assert.equal(colors.background, colors.expectedBackground, 'selection uses the quiet theme surface');
+ assert.equal(colors.foreground, colors.expectedForeground, 'selection keeps normal text contrast');
+ }
if (ui.case === 'states') {
for (const state of ['running', 'awaiting', 'done', 'unread', 'error']) {
const dot = page.locator(`[data-teammate-status="${state}"]`);
@@ -90,6 +109,7 @@ export default {
await ui.capture('expanded-states');
await page.getByRole('button', { name: await ui.t('bots.title'), exact: true }).click();
await page.locator('[data-teammate-status="running"]').first().waitFor();
+ assert.equal(await page.locator('[data-sidebar-section="teammates"]').first().locator('button[aria-current="page"] > [data-teammate-status="awaiting"]').count(), 1, 'selection preserves the pending point');
await ui.capture('collapsed-states');
return;
}
diff --git a/apps/desktop/src/renderer/features/bots/BotGroupAvatars.tsx b/apps/desktop/src/renderer/features/bots/BotGroupAvatars.tsx
index a2472876c0..b59976a67b 100644
--- a/apps/desktop/src/renderer/features/bots/BotGroupAvatars.tsx
+++ b/apps/desktop/src/renderer/features/bots/BotGroupAvatars.tsx
@@ -54,7 +54,7 @@ export function BotGroupSidebarAvatar({
'absolute flex rounded-full',
'border-2',
selected
- ? 'border-sidebar-item-active'
+ ? 'border-sidebar'
: 'border-sidebar group-hover:border-sidebar-item-hover',
)}
style={{
@@ -86,7 +86,7 @@ export function BotGroupSidebarAvatar({
'absolute bottom-0 right-0 flex rounded-full',
'border-2',
selected
- ? 'border-sidebar-item-active'
+ ? 'border-sidebar'
: 'border-sidebar group-hover:border-sidebar-item-hover',
)}
>
diff --git a/apps/desktop/src/renderer/features/bots/BotGroupSidebarRow.tsx b/apps/desktop/src/renderer/features/bots/BotGroupSidebarRow.tsx
index 5450db9090..e70d27773c 100644
--- a/apps/desktop/src/renderer/features/bots/BotGroupSidebarRow.tsx
+++ b/apps/desktop/src/renderer/features/bots/BotGroupSidebarRow.tsx
@@ -1,3 +1,4 @@
+import { teammateSelectionStyle } from './teammateSelection';
import { TeammateStatusDot } from './TeammateStatusDot';
import { groupTeammateStatus } from './teammateRosterStatus';
/**
@@ -187,6 +188,7 @@ export function BotGroupSidebarRow({
key={group.id}
type="button"
data-bot-group-id={group.id}
+ style={teammateSelectionStyle}
aria-current={selected ? 'page' : undefined}
onClick={() => onOpenGroup(group.id)}
onContextMenu={onContextMenu}
@@ -200,7 +202,7 @@ export function BotGroupSidebarRow({
)}
>
<span className="relative shrink-0"><BotGroupSidebarAvatar members={group.members} selected={selected} />
- <TeammateStatusDot status={groupTeammateStatus(group, bots, islandActivity, unread > 0)} selected={selected} />
+ <TeammateStatusDot status={groupTeammateStatus(group, bots, islandActivity, unread > 0)} />
</span>
<span className="flex min-w-0 flex-1 flex-col gap-0.5">
<span className="flex min-w-0 items-center gap-1.5">
diff --git a/apps/desktop/src/renderer/features/bots/CindyDeviceRow.tsx b/apps/desktop/src/renderer/features/bots/CindyDeviceRow.tsx
index e1d8221875..e5cbf6dfec 100644
--- a/apps/desktop/src/renderer/features/bots/CindyDeviceRow.tsx
+++ b/apps/desktop/src/renderer/features/bots/CindyDeviceRow.tsx
@@ -1,3 +1,4 @@
+import { teammateSelectionStyle } from './teammateSelection';
import type { KeyboardEventHandler, MouseEventHandler, ReactNode } from 'react';
import { Pin } from 'lucide-react';
import { useTranslation } from 'react-i18next';
@@ -43,6 +44,7 @@ export function CindyDeviceRow({
return (
<div
data-testid="cindy-device-row"
+ style={teammateSelectionStyle}
className={cn(
'group relative flex w-full items-center gap-2.5 rounded-xl px-2.5 py-2 transition-colors',
selected
@@ -61,7 +63,7 @@ export function CindyDeviceRow({
/>
<span className="pointer-events-none relative flex shrink-0">
<BotAvatar bot={bot} size="row" />
- <TeammateStatusDot status={status} selected={selected} />
+ <TeammateStatusDot status={status} />
</span>
<div className="pointer-events-none relative grid min-w-0 flex-1 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-2.5 gap-y-0.5">
<span className="flex min-w-0 items-center gap-2">
diff --git a/apps/desktop/src/renderer/features/bots/TeammateStatusDot.tsx b/apps/desktop/src/renderer/features/bots/TeammateStatusDot.tsx
index bf8a9adaaf..3579991f2c 100644
--- a/apps/desktop/src/renderer/features/bots/TeammateStatusDot.tsx
+++ b/apps/desktop/src/renderer/features/bots/TeammateStatusDot.tsx
@@ -1,6 +1,5 @@
import { useTranslation } from 'react-i18next';
import { TEAMMATE_AVATAR, type TeammateStatus } from '@cindy/maker-shared/teammate-status';
-import { cn } from '@/lib/utils';
const COLOR: Record<Exclude<TeammateStatus, 'idle'>, string> = {
awaiting: 'var(--card-status-awaiting)', error: 'var(--card-status-error)',
@@ -8,13 +7,12 @@ const COLOR: Record<Exclude<TeammateStatus, 'idle'>, string> = {
};
/** One fixed solid point, including while running. No changing glyph or outer progress ring. */
-export function TeammateStatusDot({ status, selected = false }: { status: TeammateStatus; selected?: boolean }) {
+export function TeammateStatusDot({ status }: { status: TeammateStatus }) {
const { t } = useTranslation();
if (status === 'idle') return null;
const label = t(`bots.avatarStatus.${status}`);
return <span role="img" aria-label={label} title={label} data-teammate-status={status}
- className={cn('absolute -bottom-px -right-px rounded-full border-solid',
- selected ? 'border-sidebar-item-active' : 'border-sidebar')}
+ className="absolute -bottom-px -right-px rounded-full border-solid border-sidebar"
style={{ width: TEAMMATE_AVATAR.dot + 2 * TEAMMATE_AVATAR.border,
height: TEAMMATE_AVATAR.dot + 2 * TEAMMATE_AVATAR.border,
borderWidth: TEAMMATE_AVATAR.border, backgroundColor: COLOR[status] }} />;
diff --git a/apps/desktop/src/renderer/features/bots/TeammatesSection.tsx b/apps/desktop/src/renderer/features/bots/TeammatesSection.tsx
index 7ba642da8a..1211c10e00 100644
--- a/apps/desktop/src/renderer/features/bots/TeammatesSection.tsx
+++ b/apps/desktop/src/renderer/features/bots/TeammatesSection.tsx
@@ -1,3 +1,4 @@
+import { teammateSelectionStyle } from './teammateSelection';
import { aggregateTeammateStatus, TEAMMATE_AVATAR } from '@cindy/maker-shared/teammate-status';
import { TeammateStatusDot } from './TeammateStatusDot';
import { localTeammateStatus, remoteTeammateStatus, groupTeammateStatus } from './teammateRosterStatus';
@@ -488,7 +489,7 @@ export function TeammatesSection() {
};
return (
- <div ref={sidebarRef} className="flex w-full flex-col gap-0.5" data-sidebar-section="teammates">
+ <div ref={sidebarRef} style={teammateSelectionStyle} className="flex w-full flex-col gap-0.5" data-sidebar-section="teammates">
{/* 段头与置顶 / 全部任务段头同款:高 24,左 24 / 右 12;动作悬停浮现。 */}
<div className="group/sidebar-header flex h-6 items-center justify-between pr-3 pl-6">
<div className="flex min-w-0 items-center gap-1">
@@ -565,7 +566,7 @@ export function TeammatesSection() {
aria-current={selected ? 'page' : undefined}
className={cn(
'relative flex h-12 w-12 shrink-0 items-center justify-center rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring',
- selected && 'ring-2 ring-[var(--sidebar-nav-text)] ring-offset-2 ring-offset-sidebar',
+ selected && 'ring-1 ring-[var(--text-tertiary)] ring-offset-2 ring-offset-sidebar',
)}
>
{entry.kind === 'group' ? (
@@ -649,7 +650,7 @@ export function TeammatesSection() {
<button key={remoteBotKey(bot)} type="button" aria-current={selected ? 'page' : undefined}
onClick={() => navigate(`/bots/remote/${encodeURIComponent(bot.deviceId)}/${encodeURIComponent(bot.id)}`)}
className={cn('flex w-full min-w-0 items-center gap-2.5 rounded-xl px-2.5 py-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring', selected ? 'bg-sidebar-item-active text-sidebar-item-active-foreground' : 'text-[var(--sidebar-nav-text)] hover:bg-sidebar-item-hover')}>
- <span className="relative shrink-0"><BotAvatar bot={bot} size="row" /><TeammateStatusDot status={statusForBot(bot)} selected={selected} /></span>
+ <span className="relative shrink-0"><BotAvatar bot={bot} size="row" /><TeammateStatusDot status={statusForBot(bot)} /></span>
<span className="flex min-w-0 flex-1 flex-col gap-0.5">
<span className="flex min-w-0 items-baseline gap-2">
<span className="min-w-0 truncate text-14 leading-5">{bot.name}</span>
@@ -722,7 +723,7 @@ export function TeammatesSection() {
className="flex min-w-0 flex-1 items-center gap-2.5 rounded-xl px-2.5 py-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"
>
{/* Keep the existing avatar size alongside identity and message preview. */}
- <span className="relative shrink-0"><BotAvatar bot={bot} size="row" /><TeammateStatusDot status={statusForBot(bot)} selected={selected} /></span>
+ <span className="relative shrink-0"><BotAvatar bot={bot} size="row" /><TeammateStatusDot status={statusForBot(bot)} /></span>
<span className="flex min-w-0 flex-1 flex-col gap-0.5">
<span className="flex items-baseline gap-2">
{bot.pinnedAt ? (
diff --git a/apps/desktop/src/renderer/features/bots/teammateSelection.ts b/apps/desktop/src/renderer/features/bots/teammateSelection.ts
new file mode 100644
index 0000000000..b8547af316
--- /dev/null
+++ b/apps/desktop/src/renderer/features/bots/teammateSelection.ts
@@ -0,0 +1,7 @@
+import type { CSSProperties } from 'react';
+
+/** Teammates use a quiet surface selection, independent of the task sidebar's inverse pill. */
+export const teammateSelectionStyle = {
+ '--sidebar-item-active': 'var(--surface-hover-hsl)',
+ '--sidebar-item-active-foreground': 'var(--sidebar-nav-text)',
+} as CSSProperties;
diff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.md
index 71942ebc44..90f8f492e0 100644
--- a/docs/design-rules/DESIGN.md
+++ b/docs/design-rules/DESIGN.md
@@ -773,7 +773,7 @@ without clearing the list or splitting Cindy by computer.
### Mobile task home teammate section (owner-approved “A+B”, 2026-10-24)
-The task home opens with a “Teammates” section above shared tasks, Pinned and projects. Its header uses the project/Pinned header geometry (56pt, 22 chevron + 20 icon + 16/28 title + 13 count) and a trailing 20pt “+” whose 44pt target ends on the 16pt right edge. Expanded, it shows 78pt teammate rows (teammates and groups mixed by activity), previewing three; the “Show all N” / “Show less” row is 48pt, 15/20 secondary text aligned to the rows’ text column (72pt). Collapsed, it becomes a horizontally scrolling strip: 48pt avatars in 56pt cells, 8pt gap, 16pt side insets, 12/18 names (primary + medium when unread), one 10pt solid status dot in a 2pt surface ring anchored 1pt beyond the bottom-right edge, and a dashed 48pt create cell last. Phones scroll instead of the Desktop +N. Desktop uses the same 48px collapsed avatar, 44px list avatar, and status-dot geometry as iOS and Android. A pending decision (cyan) takes priority over error/offline (red), running (orange), completed unread (green), and ordinary unread (blue); idle has no dot. The overflow entry aggregates the highest-priority hidden state. Completion requires a real result and a local unread receipt; selection alone never clears a pending decision. Roster avatars have no online dot or working ring; unread counts remain separate. Both states swap with the list’s 225ms disclosure; reduced motion switches instantly. Every language must fit the header and names without widening; long names truncate to one line within the cell.
+The task home opens with a “Teammates” section above shared tasks, Pinned and projects. Its header uses the project/Pinned header geometry (56pt, 22 chevron + 20 icon + 16/28 title + 13 count) and a trailing 20pt “+” whose 44pt target ends on the 16pt right edge. Expanded, it shows 78pt teammate rows (teammates and groups mixed by activity), previewing three; the “Show all N” / “Show less” row is 48pt, 15/20 secondary text aligned to the rows’ text column (72pt). Collapsed, it becomes a horizontally scrolling strip: 48pt avatars in 56pt cells, 8pt gap, 16pt side insets, 12/18 names (primary + medium when unread), one 10pt solid status dot in a 2pt surface ring anchored 1pt beyond the bottom-right edge, and a dashed 48pt create cell last. Phones scroll instead of the Desktop +N. Desktop uses the same 48px collapsed avatar, 44px list avatar, and status-dot geometry as iOS and Android. A pending decision (cyan) takes priority over error/offline (red), running (orange), completed unread (green), and ordinary unread (blue); idle has no dot. The overflow entry aggregates the highest-priority hidden state. Completion requires a real result and a local unread receipt; selection alone never clears a pending decision. Roster avatars have no online dot or working ring; unread counts remain separate. Teammate selection uses the quiet theme surface with normal sidebar text (never the task sidebar’s inverse fill); collapsed selection is a 1px tertiary circular outline with 2px separation. Selection does not replace or recolor the activity dot. Phones navigate to the full-screen chat and retain their native press feedback, without a persistent selected home row. Both states swap with the list’s 225ms disclosure; reduced motion switches instantly. Every language must fit the header and names without widening; long names truncate to one line within the cell.
There is one mobile home, as on Desktop (owner decision, 2026-10-24): no separate teammate home, no Tasks/Teammates switch in the drawer and no Teammates entry in the title scope menu. Home search keeps the section and lists every matching teammate and group as expanded rows, without the fold toggle or create entries; with no match the section is absent. Teammate unread shows on the section's rows and strip cells, not as a count on a mode switch.