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): 修复伙伴/群设置抽屉关闭按钮点击无效

Dash928e9d48a9b8
diff --git a/apps/desktop/src/renderer/features/bots/BotGroupSettingsDrawer.tsx b/apps/desktop/src/renderer/features/bots/BotGroupSettingsDrawer.tsx
index ea27db6376..9a4d824e3e 100644
--- a/apps/desktop/src/renderer/features/bots/BotGroupSettingsDrawer.tsx
+++ b/apps/desktop/src/renderer/features/bots/BotGroupSettingsDrawer.tsx
@@ -13,6 +13,7 @@ import { Folder, Plus, X } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { matchPath, useLocation, useNavigate, useSearchParams } from 'react-router-dom';
+import { WINDOW_NO_DRAG_STYLE } from '@/components/layout/windowDrag';
import { Button } from '@/components/ui/button';
import { useConfirmDialog } from '@/components/ui/confirm-dialog-provider';
import { FormField } from '@/components/ui/form-field';
@@ -79,6 +80,9 @@ export function BotGroupSettingsDrawer() {
if (event.isComposing || event.keyCode === 229) event.preventDefault();
}}
className="fixed inset-y-0 right-0 z-50 flex w-full max-w-md flex-col border-l border-[var(--border-default)] bg-[var(--surface)] outline-none"
+ // The header shares the window title strip; without no-drag the page's drag
+ // regions underneath swallow the close button's clicks (see windowDrag.tsx).
+ style={WINDOW_NO_DRAG_STYLE}
>
<header className="flex h-14 shrink-0 items-center justify-between border-b border-[var(--border-default)] px-5">
<Dialog.Title className="text-15 font-medium text-[var(--text-primary)]">
diff --git a/apps/desktop/src/renderer/features/bots/BotSettingsDrawer.tsx b/apps/desktop/src/renderer/features/bots/BotSettingsDrawer.tsx
index 27b8acd32b..0942507d3c 100644
--- a/apps/desktop/src/renderer/features/bots/BotSettingsDrawer.tsx
+++ b/apps/desktop/src/renderer/features/bots/BotSettingsDrawer.tsx
@@ -3,6 +3,8 @@ import * as Dialog from '@radix-ui/react-dialog';
import { X } from 'lucide-react';
import { matchPath, useBlocker, useLocation, useNavigate, useSearchParams } from 'react-router-dom';
+import { WINDOW_NO_DRAG_STYLE } from '@/components/layout/windowDrag';
+
import { BotPronounProvider, useBotTranslation } from './botPronounContext';
import { BotSettings } from './BotsHomeView';
import { useBotProfiles } from './botStore';
@@ -114,6 +116,9 @@ export function BotSettingsDrawer() {
if (event.isComposing || event.keyCode === 229) event.preventDefault();
}}
className="fixed inset-y-0 right-0 z-50 flex w-full max-w-md flex-col border-l border-[var(--border-default)] bg-[var(--surface)] outline-none"
+ // The header shares the window title strip; without no-drag the page's drag
+ // regions underneath swallow the close button's clicks (see windowDrag.tsx).
+ style={WINDOW_NO_DRAG_STYLE}
>
<header className="flex h-14 shrink-0 items-center justify-between border-b border-[var(--border-default)] px-5">
<Dialog.Title className="text-15 font-medium text-[var(--text-primary)]">
diff --git a/apps/desktop/src/renderer/features/bots/__tests__/BotGroupSettingsDrawer.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/BotGroupSettingsDrawer.test.tsx
index be290eeb40..43a59ea6fb 100644
--- a/apps/desktop/src/renderer/features/bots/__tests__/BotGroupSettingsDrawer.test.tsx
+++ b/apps/desktop/src/renderer/features/bots/__tests__/BotGroupSettingsDrawer.test.tsx
@@ -95,6 +95,13 @@ beforeEach(() => {
afterEach(cleanup);
+it('keeps the drawer out of the window drag region so its close button stays clickable', () => {
+ renderDrawer();
+ // Portaled after the page's title-bar drag strip, so this no-drag wins under the close button.
+ const dialog = screen.getByRole('dialog');
+ expect((dialog.style as CSSStyleDeclaration & { WebkitAppRegion?: string }).WebkitAppRegion).toBe('no-drag');
+});
+
describe('BotGroupSettingsDrawer 分工 settings', () => {
it('tags the organizer and lets another active member take over', async () => {
renderDrawer();
diff --git a/apps/desktop/src/renderer/features/bots/__tests__/botSettingsDrawer.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/botSettingsDrawer.test.tsx
index 08597dc755..0ce088e0a7 100644
--- a/apps/desktop/src/renderer/features/bots/__tests__/botSettingsDrawer.test.tsx
+++ b/apps/desktop/src/renderer/features/bots/__tests__/botSettingsDrawer.test.tsx
@@ -189,6 +189,8 @@ describe('BotSettingsDrawer', () => {
expect(dialog.className).toContain('right-0');
expect(dialog.className).toContain('w-full');
expect(dialog.className).toContain('max-w-md');
+ // Portaled after the page's title-bar drag strip, so this no-drag wins under the close button.
+ expect((dialog.style as CSSStyleDeclaration & { WebkitAppRegion?: string }).WebkitAppRegion).toBe('no-drag');
expect(screen.getByTestId('chat-underlay')).toBeTruthy();
expect(screen.getByTestId('simple-bot-settings')).toBeTruthy();