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(desktop): 侧栏 hover 恢复普通指针,不再显示 grab (#2731)

Dashc53df749462b
diff --git a/apps/desktop/src/renderer/__tests__/sidebarRemoteProjectIcon.test.ts b/apps/desktop/src/renderer/__tests__/sidebarRemoteProjectIcon.test.ts
index f9298de4b9..b300c28e31 100644
--- a/apps/desktop/src/renderer/__tests__/sidebarRemoteProjectIcon.test.ts
+++ b/apps/desktop/src/renderer/__tests__/sidebarRemoteProjectIcon.test.ts
@@ -56,7 +56,7 @@ describe('sidebar remote project icon', () => {
it('keeps remote session icons next to titles instead of in the right-side time slots', () => {
expect(sessionItemSource).toMatch(
- /<span[\s\S]*?className=\{cn\(\s*'min-w-0 flex flex-1 items-center gap-1\.5'[\s\S]*?<SidebarTitleMarquee[\s\S]*?\{remoteIconKind && \([\s\S]*?<RemoteProjectIcon/,
+ /<span[\s\S]*?className="min-w-0 flex flex-1 items-center gap-1\.5"[\s\S]*?<SidebarTitleMarquee[\s\S]*?\{remoteIconKind && \([\s\S]*?<RemoteProjectIcon/,
);
// C 期起右侧时间槽由 SessionInfoMeta 承担(任务信息复选),仍在同一让位容器内。
expect(sessionItemSource).toMatch(
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsx
index e771160f70..f6c194343d 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionCard.tsx
@@ -659,10 +659,9 @@ export function SessionCard({
setMenuPos({ x: e.clientX, y: e.clientY });
}}
className={cn(
- 'group/card relative w-full overflow-hidden text-left',
- splitDragEnabled && !needsSplitDragHandle
- ? 'cursor-grab active:cursor-grabbing'
- : 'cursor-pointer',
+ // 侧栏任务本身是可点击导航。拖拽能力不改变 hover 光标;
+ // grab 只在真正拖动中由 Sortable / 系统拖拽态负责。
+ 'group/card relative w-full overflow-hidden text-left cursor-pointer',
variant === 'list'
? cn(
// 扁平行(类 Telegram / 对话列表):无描边、无卡片底色,仅 hover/active 行底色。
@@ -723,10 +722,7 @@ export function SessionCard({
data-split-group-drag-handle={splitDragHandleActive ? 'true' : undefined}
data-no-drag={splitDragHandleActive ? 'true' : undefined}
draggable={splitDragHandleActive}
- className={cn(
- 'relative flex h-5 min-w-0 flex-1 items-center gap-0',
- splitDragHandleActive && 'cursor-grab active:cursor-grabbing',
- )}
+ className="relative flex h-5 min-w-0 flex-1 items-center gap-0"
>
<span className="flex shrink-0 items-center">{titlePrefixNode}</span>
{isEditing ? (
@@ -831,7 +827,6 @@ export function SessionCard({
className={cn(
'mt-1 overflow-hidden text-11 leading-[1.45]',
'[display:-webkit-box] [-webkit-line-clamp:1] [-webkit-box-orient:vertical]',
- splitDragHandleActive && 'cursor-grab active:cursor-grabbing',
rightStatusKind !== 'time' && 'pr-5',
awaitingText
? isActive
@@ -921,10 +916,7 @@ export function SessionCard({
data-split-group-drag-handle={splitDragHandleActive ? 'true' : undefined}
data-no-drag={splitDragHandleActive ? 'true' : undefined}
draggable={splitDragHandleActive}
- className={cn(
- 'relative',
- splitDragHandleActive && 'cursor-grab active:cursor-grabbing',
- )}
+ className="relative"
>
<div
className={cn(
@@ -976,7 +968,6 @@ export function SessionCard({
'mt-[4px] text-11 leading-[1.4]',
'[display:-webkit-box] [-webkit-box-orient:vertical] overflow-hidden',
'text-[var(--text-secondary)]',
- splitDragHandleActive && 'cursor-grab active:cursor-grabbing',
)}
style={{ WebkitLineClamp: cardPreviewLineClamp }}
>
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx
index e4ad95b5e8..97c34697a3 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionItem.tsx
@@ -928,10 +928,7 @@ export const SessionItem = memo(function SessionItem({
data-split-group-drag-handle={splitDragHandleActive ? 'true' : undefined}
data-no-drag={splitDragHandleActive ? 'true' : undefined}
draggable={splitDragHandleActive}
- className={cn(
- 'min-w-0 flex flex-1 items-center gap-1.5',
- splitDragHandleActive && 'cursor-grab active:cursor-grabbing',
- )}
+ className="min-w-0 flex flex-1 items-center gap-1.5"
>
{/* 绑定徽章优先于普通自动化 Timer:persistentSession 会话两者皆真,
主图标统一为 Timer,绑定态额外承载频率/暂停信息。 */}
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/SessionCard.visual.test.ts b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/SessionCard.visual.test.ts
index 9f7992b492..86e1fb4000 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/SessionCard.visual.test.ts
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/SessionCard.visual.test.ts
@@ -338,7 +338,10 @@ describe('SessionCard visual cases', () => {
'button[aria-label="ccAgent.sidebar.sessionMenu.moreActions"]',
);
expect(card?.draggable).toBe(true);
+ expect(card?.className).toContain('cursor-pointer');
+ expect(card?.className).not.toContain('cursor-grab');
expect(card?.querySelector('[data-split-group-drag-handle="true"]')).toBeNull();
+ expect(title.className).not.toContain('cursor-grab');
expect(actionButton).not.toBeNull();
fireEvent.pointerDown(title, { button: 0, pointerType: 'mouse' });
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionRowRenderIsolation.test.ts b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionRowRenderIsolation.test.ts
index d1991ff0eb..6154efc2ff 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionRowRenderIsolation.test.ts
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionRowRenderIsolation.test.ts
@@ -271,8 +271,11 @@ describe('SessionItem — 置顶分屏拖拽', () => {
'button[aria-label="ccAgent.sidebar.sessionMenu.moreActions"]',
);
expect(row?.draggable).toBe(true);
+ expect(row?.className).toContain('cursor-pointer');
+ expect(row?.className).not.toContain('cursor-grab');
expect(row?.querySelector('[data-split-group-drag-handle="true"]')).toBeNull();
expect(title).not.toBeNull();
+ expect(title?.className).not.toContain('cursor-grab');
expect(actionButton).not.toBeNull();
fireEvent.pointerDown(title!, { button: 0, pointerType: 'mouse' });