mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-10-09 15:58:34 +00:00
41ebe0fa64
The top-bar AI button previously dispatched netcatty:toggle-ai-panel,
which was wired to handleOpenAI -> handleSwitchSidePanelTab('ai'). That
switch is a no-op when AI is already the open sub-panel, so the panel
could not be dismissed by clicking the button again.
Add a dedicated handleToggleAiFromTopBar that routes through a new
resolveAiSidePanelToggleIntent helper: a second click on an already-open
AI panel closes the side panel, while a click from a closed panel or a
different sub-panel switches to AI. The top-bar event listener now uses
this toggle handler. handleOpenAI stays a plain switch so the AI icon in
the side-panel rail remains idempotent like the other rail tabs.
Also remove the non-functional reminder (bell) button from the top bar;
it had no click handler and no backing feature.
Refs #1194
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
21 lines
806 B
TypeScript
21 lines
806 B
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import { resolveAiSidePanelToggleIntent } from "./resolveAiSidePanelToggleIntent.ts";
|
|
|
|
test("close: AI panel already open → close the side panel", () => {
|
|
const r = resolveAiSidePanelToggleIntent("ai");
|
|
assert.deepEqual(r, { kind: "closeTerminalSidePanel" });
|
|
});
|
|
|
|
test("open: no panel open → open AI", () => {
|
|
const r = resolveAiSidePanelToggleIntent(null);
|
|
assert.deepEqual(r, { kind: "openAi" });
|
|
});
|
|
|
|
test("open: a different sub-panel is open → switch to AI", () => {
|
|
assert.deepEqual(resolveAiSidePanelToggleIntent("sftp"), { kind: "openAi" });
|
|
assert.deepEqual(resolveAiSidePanelToggleIntent("scripts"), { kind: "openAi" });
|
|
assert.deepEqual(resolveAiSidePanelToggleIntent("theme"), { kind: "openAi" });
|
|
});
|