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(sharing): center shared task close actions

DavidShen92833b817e95
diff --git a/apps/desktop/src/renderer/features/device-link/SharedTaskButton.tsx b/apps/desktop/src/renderer/features/device-link/SharedTaskButton.tsx
index e43d1d3940..0397e38d5f 100644
--- a/apps/desktop/src/renderer/features/device-link/SharedTaskButton.tsx
+++ b/apps/desktop/src/renderer/features/device-link/SharedTaskButton.tsx
@@ -201,7 +201,7 @@ export function SharedTaskButton({ session }: { session: Session }) {
</div>;
})}
<div className={noticeClass}><Clock size={16} className="mt-0.5 shrink-0" aria-hidden /><p>{t(session.deviceLinkDeviceId ? 'sharedTask.remoteHostOfflineNote' : 'sharedTask.hostOfflineNote')}</p></div>
- <div className="mt-5"><Button variant="secondary" size="lg" disabled={busy} className="w-full px-4 text-[var(--error-fg)]"
+ <div className="mt-5 flex justify-center"><Button variant="secondary" size="lg" disabled={busy} className="w-full px-4 text-[var(--error-fg)]"
onClick={() => setConfirm({ kind: 'closeCurrent' })}>{t('sharedTask.closeCurrent')}</Button></div>
</>
: <div className="px-1 py-6 text-center">
@@ -236,7 +236,7 @@ export function SharedTaskButton({ session }: { session: Session }) {
</div>)}
</div>
<div className="mt-4 border-t border-[var(--border-default)] pt-4 text-12 text-[var(--text-secondary)]">{t('sharedTask.closeAllNote')}</div>
- <div className="mt-5"><Button variant="secondary" size="lg" disabled={busy} className="w-full gap-2 text-[var(--error-fg)]"
+ <div className="mt-5 flex justify-center"><Button variant="secondary" size="lg" disabled={busy} className="w-full gap-2 text-[var(--error-fg)]"
onClick={() => setConfirm({ kind: 'closeAll' })}><CircleStop size={18} aria-hidden />{t('sharedTask.closeAll', { count: owned.length })}</Button></div>
</>;
const confirmation = confirm ? confirmCopy(confirm) : null;
diff --git a/apps/desktop/src/renderer/features/device-link/__tests__/SharedTaskButton.test.tsx b/apps/desktop/src/renderer/features/device-link/__tests__/SharedTaskButton.test.tsx
index 7e4523ec16..e6e5cdb494 100644
--- a/apps/desktop/src/renderer/features/device-link/__tests__/SharedTaskButton.test.tsx
+++ b/apps/desktop/src/renderer/features/device-link/__tests__/SharedTaskButton.test.tsx
@@ -108,6 +108,7 @@ it.each([false, true])('refreshes members after an already-left removal complete
const closeCurrent = within(body).getByRole('button', { name: 'sharedTask.closeCurrent' });
expect(closeCurrent).toBeDefined();
expect(closeCurrent.className).toContain('w-full');
+ expect(closeCurrent.parentElement?.className).toContain('justify-center');
expect(command).toHaveBeenCalledWith({ action: 'remove', sharedTaskId: 'st1', memberId: 'left' });
expect(toast.error).not.toHaveBeenCalled();
});
@@ -143,6 +144,9 @@ it('lists owned shares and routes close-all through the account command', async
expect(confirmation.contains(document.activeElement)).toBe(true);
expect(document.activeElement?.textContent).toBe('sharedTask.closeAllKeep');
expect(within(confirmation).getByText('sharedTask.closeAllBody').className).toContain('text-13');
+ const closeAll = [...body.querySelectorAll('button')].find((button) => button.textContent?.startsWith('sharedTask.closeAll'))!;
+ expect(closeAll.className).toContain('w-full');
+ expect(closeAll.parentElement?.className).toContain('justify-center');
expect(within(confirmation).getAllByRole('button').map((button) => button.textContent)).toEqual([
'sharedTask.closeAllKeep', 'sharedTask.closeAllAction',
]);
diff --git a/docs/product-rules/shared-task-mode.md b/docs/product-rules/shared-task-mode.md
index b10a06d8d9..b254bfcd12 100644
--- a/docs/product-rules/shared-task-mode.md
+++ b/docs/product-rules/shared-task-mode.md
@@ -92,6 +92,7 @@
- 共享任务行沿用普通任务的 Agent 身份图标,按任务的 Agent 类型显示;不得因共享状态替换为人群图标。
- 已加入任务直接打开既有任务页面,重复点击当前任务不重新连接、不清空页面。访客撤权继续使用现有结束提示与清理路径,不缓存已失效的可访问内容。
- “我加入的共享”分组标题、角色切换条和任务行不提供右键菜单,也不触发侧栏空白处的整理菜单;“我开启的共享”任务行复用普通任务的右键菜单与归档快捷操作,归档或删除前先停止共享。左键折叠/展开、切换角色与进入任务保持不变,共享管理仍使用任务内已有入口(2026-09-21,用户确认)。侧栏其他区域的右键行为不变。
+- 当前任务管理页底部的“关闭此任务的共享”与“我发起的共享”页底部的“关闭全部共享”使用同一底部居中、全宽危险操作布局,避免同类关闭操作出现左对齐差异。
- 共享只是新增分组:任务行复用普通主列表的文字/列表显示模式、标题、最近消息预览、Agent 图标及状态信息,不使用“这台电脑/其他电脑/共享任务”替代预览。“我加入的共享”保留仅导航交互;“我开启的共享”沿用普通任务右键行为,但归档/删除必须先停止共享。尚未取得跨设备任务镜像时只显示已知标题,仍可点击进入,不伪造预览、时间或 Agent 身份(2026-09-21,用户确认)。
- 加入弹窗采用 C 方案:标题说明下显示「我发起的共享 / N 个进行中」,右侧灰阶「关闭全部共享」,与底部加入按钮分离。无共享时禁用,获取失败可重试,不把未知状态当成零个。
- 关闭确认在同一个窗口内替换表单内容,不叠加第二个弹窗;列出确认时的任务及所在电脑类别,默认聚焦取消。取消保留邀请与昵称。只关闭确认清单中的我发起的共享,失败保留未关闭项重试;不退出我加入的任务、不停止 Agent、不删除记录。账号变化或窗口退出后,旧请求不得继续操作下一项。