From 8f6688e76ed4819ab17dd00addc91953a2985448 Mon Sep 17 00:00:00 2001 From: Federico Jaramillo Martinez Date: Tue, 21 Jul 2026 15:31:39 +0200 Subject: [PATCH] fix(ui): restore in-pane minimise chevron for session warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Re-add the minimise chevron to the expanded session-warnings pane in ChatView, wired to the existing unified onToggleWarnings (toggle ≡ collapse in the expanded state). The status-bar warning toggle from a13778c is retained unchanged; both controls share the single sessionWarningVisibility mutation, so they cannot desync. - ChatView: onToggleWarnings prop + handleToggleWarnings; chevron rendered inline via html (no svg re-import), guarded by onToggleWarnings === undefined. - PiWebApp: renderChatView passes .onToggleWarnings. - shared.ts: restore .session-warnings-controls / -collapse / icon CSS. - ChatView.test.ts: restore the chevron-wiring test against onToggleWarnings via the session-warnings-collapse marker. Relay restore-warning-chevron leg 1. --- src/client/src/components/ChatView.test.ts | 18 ++++++++++++++++++ src/client/src/components/ChatView.ts | 20 ++++++++++++++++++++ src/client/src/components/PiWebApp.ts | 2 +- src/client/src/components/shared.ts | 5 +++++ 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/client/src/components/ChatView.test.ts b/src/client/src/components/ChatView.test.ts index 6c846a7..87091e8 100644 --- a/src/client/src/components/ChatView.test.ts +++ b/src/client/src/components/ChatView.test.ts @@ -141,6 +141,24 @@ describe("ChatView session-warning dismiss wiring", () => { expect(onDismissWarning).toHaveBeenCalledExactlyOnceWith("anthropicExtraUsage"); }); + // Escape hatch: this verifies the minimise chevron's Lit callback wiring in + // the node test environment, anchored to its stable semantic class marker. + // The chevron is wired to the unified onToggleWarnings (toggle ≡ collapse in + // the expanded state), so this also proves the single visibility mutation. + it("invokes onToggleWarnings from the visible warning area", () => { + const view = withStatus(new ChatView(), warningStatus([ + { severity: "warning", message: "subscription auth is active" }, + ])); + const onToggleWarnings = vi.fn(); + view.onToggleWarnings = onToggleWarnings; + + const rendered = renderWarnings(view); + if (rendered === null) throw new Error("expected a warnings banner"); + templateEventHandlerAfterMarker(rendered, "session-warnings-collapse")(new Event("click")); + + expect(onToggleWarnings).toHaveBeenCalledOnce(); + }); + it("removes the warning area while presentation is collapsed or there are no warnings", () => { const view = withStatus(new ChatView(), warningStatus([ { severity: "warning", message: "subscription auth is active" }, diff --git a/src/client/src/components/ChatView.ts b/src/client/src/components/ChatView.ts index b8c7390..b17e8ee 100644 --- a/src/client/src/components/ChatView.ts +++ b/src/client/src/components/ChatView.ts @@ -199,6 +199,7 @@ export class ChatView extends LitElement { @property({ attribute: false }) onDismissNotification?: (notificationId: string) => void; @property({ attribute: false }) onDismissAllNotifications?: () => void; @property({ type: Boolean }) warningsVisible = true; + @property({ attribute: false }) onToggleWarnings?: () => void; @property({ attribute: false }) onLoadMore?: () => void; @query(".chat") private chat?: HTMLDivElement; @query("dialog.image-zoom") private imageZoomDialog?: HTMLDialogElement; @@ -252,6 +253,9 @@ export class ChatView extends LitElement { private readonly handleClearServerQueue = (): void => { this.onClearServerQueue?.(); }; + private readonly handleToggleWarnings = (): void => { + this.onToggleWarnings?.(); + }; override connectedCallback(): void { super.connectedCallback(); @@ -511,6 +515,22 @@ export class ChatView extends LitElement { if (!this.warningsVisible || rows.length === 0) return null; return html`