Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): 禁用状态统一使用普通指针 (#3246)
Dash482f3e9e2e2c
diff --git a/apps/desktop/src/renderer/__tests__/disabledCursorVisualContract.test.ts b/apps/desktop/src/renderer/__tests__/disabledCursorVisualContract.test.tsnew file mode 100644index 0000000000..7202ea42eb--- /dev/null+++ b/apps/desktop/src/renderer/__tests__/disabledCursorVisualContract.test.ts@@ -0,0 +1,34 @@+import { readFileSync } from 'node:fs';+import { resolve } from 'node:path';++import { describe, expect, it } from 'vitest';++const colorsSource = readFileSync(resolve(__dirname, '..', 'themes', 'colors.ts'), 'utf8');+const globalsSource = readFileSync(resolve(__dirname, '..', 'styles', 'globals.css'), 'utf8');+const makerExperimentalSource = readFileSync(+ resolve(__dirname, '..', 'features', 'maker-experimental', 'MakerExperimentalView.tsx'),+ 'utf8',+);++describe('Desktop disabled cursor visual contract', () => {+ it('uses the ordinary arrow instead of a theme-provided SVG cursor', () => {+ const disabledCursorRule = globalsSource.match(+ /\.cursor-not-allowed,[^{}]*\{[^{}]*\}/,+ )?.[0];++ expect(colorsSource).not.toContain('createNotAllowedCursor');+ expect(colorsSource).not.toContain("registerColor('cursor-not-allowed'");+ expect(disabledCursorRule).toBeDefined();+ expect(disabledCursorRule).toContain('.cursor-not-allowed');+ expect(disabledCursorRule).toContain('.disabled\\:cursor-not-allowed:disabled');+ expect(disabledCursorRule).toContain(+ '.data-\\[disabled\\]\\:cursor-not-allowed[data-disabled]',+ );+ expect(disabledCursorRule).toContain('cursor: default;');+ expect(disabledCursorRule).not.toContain('var(--cursor-not-allowed');+ expect(globalsSource).not.toContain("html[data-platform='win32'] .cursor-not-allowed");+ expect(makerExperimentalSource).not.toContain('var(--cursor-not-allowed');+ expect(makerExperimentalSource).not.toContain("window.electronAPI.platform === 'win32'");+ expect(makerExperimentalSource).toContain("cursor: m.session ? 'default' : 'pointer'");+ });+});diff --git a/apps/desktop/src/renderer/features/maker-experimental/MakerExperimentalView.tsx b/apps/desktop/src/renderer/features/maker-experimental/MakerExperimentalView.tsxindex b061205c1d..8b24c17106 100644--- a/apps/desktop/src/renderer/features/maker-experimental/MakerExperimentalView.tsx+++ b/apps/desktop/src/renderer/features/maker-experimental/MakerExperimentalView.tsx@@ -188,11 +188,7 @@ export function MakerExperimentalView(): ReactElement {color: '#d4d4d4',border: '1px solid #333',borderRadius: 4,- cursor: m.session- ? window.electronAPI.platform === 'win32'- ? 'var(--cursor-not-allowed, not-allowed)'- : 'not-allowed'- : 'pointer',+ cursor: m.session ? 'default' : 'pointer',opacity: m.session ? 0.5 : 1,}}>diff --git a/apps/desktop/src/renderer/styles/globals.css b/apps/desktop/src/renderer/styles/globals.cssindex 6fca73563a..3b4120bcc7 100644--- a/apps/desktop/src/renderer/styles/globals.css+++ b/apps/desktop/src/renderer/styles/globals.css@@ -1989,10 +1989,12 @@ body.resizing-pane [data-ghost-webview] {color: var(--sidebar-item-active-foreground);}- html[data-platform='win32'] .cursor-not-allowed,- html[data-platform='win32'] .disabled\:cursor-not-allowed:disabled,- html[data-platform='win32'] .data-\[disabled\]\:cursor-not-allowed[data-disabled] {- cursor: var(--cursor-not-allowed, not-allowed);+ /* Disabled controls keep the ordinary desktop arrow. Their visual disabled+ state already comes from opacity/color, so a separate cursor adds noise. */+ .cursor-not-allowed,+ .disabled\:cursor-not-allowed:disabled,+ .data-\[disabled\]\:cursor-not-allowed[data-disabled] {+ cursor: default;}}diff --git a/apps/desktop/src/renderer/themes/colors.ts b/apps/desktop/src/renderer/themes/colors.tsindex eb01787886..ed80d50c73 100644--- a/apps/desktop/src/renderer/themes/colors.ts+++ b/apps/desktop/src/renderer/themes/colors.ts@@ -1,13 +1,6 @@import { registerColor } from './color-registry';import { EFFORT_TIER_COLORS, PRICE_TIER_COLORS } from './effortTierColors';-function createNotAllowedCursor(stroke: string): string {- const encodedStroke = stroke.startsWith('#')- ? `%23${stroke.slice(1)}`- : encodeURIComponent(stroke);- return `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='10' fill='none' stroke='${encodedStroke}' stroke-width='2.6'/%3E%3Cpath d='M9.2 22.8 22.8 9.2' fill='none' stroke='${encodedStroke}' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E") 16 16, not-allowed`;-}-/* === P3.2: Semantic slot tokens === */registerColor('surface', {light: '#f8f8f6',@@ -190,10 +183,6 @@ registerColor('text-placeholder', {light: '#c4c4c4',dark: '#525252',}, 'Placeholder 文字 — 必须读着像空(比 tertiary 更淡);统一 slot,各输入面 placeholder alias 均收口于此');-registerColor('cursor-not-allowed', {- light: createNotAllowedCursor('#373737'),- dark: createNotAllowedCursor('#d4d4d4'),-}, 'Windows disabled cursor SVG (完整 cursor 值,可由主题覆盖)');registerColor('accent-cta-bg', {light: '#262626',dark: '#ffffff',