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): 任务复制弹窗按钮改用确认框配色 (#5424)

Dasha892ba867641
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/TaskMigrationDialog.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/TaskMigrationDialog.tsx
index f304c05a58..d1b92309f8 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/TaskMigrationDialog.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/TaskMigrationDialog.tsx
@@ -19,6 +19,15 @@ import {
isDataOwnerGenerationCurrent,
} from '@/contexts/dataOwnerGeneration';
+// Same action-button treatment as the shared confirm dialog: this dialog paints the
+// confirmation surface, where the default button palette has almost no contrast.
+const actionButton = {
+ size: 'lg',
+ palette: 'confirmation',
+ className:
+ 'h-auto min-h-9 min-w-[96px] max-w-full whitespace-normal [overflow-wrap:anywhere] py-1.5',
+} as const;
+
export function TaskMigrationDialog({
session,
onDismiss,
@@ -495,30 +504,36 @@ export function TaskMigrationDialog({
)}
</p>
)}
- <div className="mt-4 flex flex-wrap justify-end gap-2">
+ <div className="mt-6 flex flex-wrap justify-end gap-2.5">
{copying ? (
<>
{status?.cancellable && (
- <Button variant="secondary" disabled={busy} onClick={cancelCopy}>
+ <Button
+ {...actionButton}
+ variant="secondary"
+ disabled={busy}
+ onClick={cancelCopy}
+ >
{t('taskMigration.cancelCopy')}
</Button>
)}
- <Button variant="secondary" disabled={busy} onClick={dismiss}>
+ <Button {...actionButton} variant="secondary" disabled={busy} onClick={dismiss}>
{t('taskMigration.runInBackground')}
</Button>
</>
) : (
- <Button variant="secondary" disabled={busy} onClick={dismiss}>
+ <Button {...actionButton} variant="secondary" disabled={busy} onClick={dismiss}>
{t(confirming ? 'taskMigration.cancel' : 'taskMigration.close')}
</Button>
)}
{complete && status?.targetSessionId && (
- <Button disabled={busy} onClick={() => void openTarget()}>
+ <Button {...actionButton} disabled={busy} onClick={() => void openTarget()}>
{t('taskMigration.openTarget')}
</Button>
)}
{confirming && (
<Button
+ {...actionButton}
disabled={!status || !estimate || busy || readyTarget !== target || !target}
onClick={() =>
void act({
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/TaskMigrationDialog.test.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/TaskMigrationDialog.test.tsx
index 0cf2e60ac9..f2ec6eab10 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/TaskMigrationDialog.test.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/TaskMigrationDialog.test.tsx
@@ -582,3 +582,42 @@ it('ignores clicks outside and only closes through Cancel or Escape', async () =
fireEvent.keyDown(dialog, { key: 'Escape' });
await waitFor(() => expect(state.dismiss).toHaveBeenCalledOnce());
});
+// The dialog paints the confirmation surface; the default Button palette has almost
+// no contrast on it, so every footer action must use the confirmation palette.
+it.each([
+ ['confirming', undefined, ['taskMigration.start'], ['taskMigration.cancel']],
+ [
+ 'copying',
+ { stage: 'transferring', running: true, cancellable: true },
+ [],
+ ['taskMigration.cancelCopy', 'taskMigration.runInBackground'],
+ ],
+ [
+ 'complete',
+ { stage: 'complete', running: false, targetDeviceId: 'B', targetSessionId: 'migrated' },
+ ['taskMigration.openTarget'],
+ ['taskMigration.close'],
+ ],
+])(
+ 'paints %s footer actions with the confirmation palette',
+ async (_stage, status, primary, secondary) => {
+ if (status)
+ state.request.mockImplementation(
+ async (device: string | null, command: { action: string }) =>
+ command.action === 'status'
+ ? status
+ : { supported: true, deviceId: device ?? 'local', projects: [] },
+ );
+ mount();
+ for (const name of primary) {
+ const button = await screen.findByRole('button', { name });
+ expect(button.className).toContain('[--button-face-bg:var(--confirm-btn-primary-bg)]');
+ }
+ for (const name of secondary) {
+ const button = await screen.findByRole('button', { name });
+ expect(button.className).toContain(
+ '[--button-face-border:var(--confirm-btn-secondary-border)]',
+ );
+ }
+ },
+);