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>
20 lines
603 B
TypeScript
20 lines
603 B
TypeScript
export type AiSidePanelToggleIntent =
|
|
| { kind: 'closeTerminalSidePanel' }
|
|
| { kind: 'openAi' };
|
|
|
|
/**
|
|
* Decide what the top-bar AI button should do given the side panel that is
|
|
* currently open for the active tab.
|
|
* - If the AI panel is already the open sub-panel → close the whole side panel.
|
|
* - Otherwise (closed, or showing a different sub-panel) → switch to AI.
|
|
*/
|
|
export function resolveAiSidePanelToggleIntent(
|
|
activePanel: string | null,
|
|
): AiSidePanelToggleIntent {
|
|
if (activePanel === 'ai') {
|
|
return { kind: 'closeTerminalSidePanel' };
|
|
}
|
|
|
|
return { kind: 'openAi' };
|
|
}
|