From 14c72bdfb29c7bc5206ed33c807582a7d1d18d0a Mon Sep 17 00:00:00 2001 From: ComputelessComputer Date: Fri, 27 Mar 2026 17:15:35 -0700 Subject: [PATCH] fix: keep the session chat toggle selected while open - keep the header chat button visible while the right panel is docked - treat floating and docked chat as an active toggle state and let the active button close chat --- apps/desktop/src/shared/main/index.tsx | 35 ++++++++++++++++++++------ 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/apps/desktop/src/shared/main/index.tsx b/apps/desktop/src/shared/main/index.tsx index 6eaa5d601f..1e36d269a1 100644 --- a/apps/desktop/src/shared/main/index.tsx +++ b/apps/desktop/src/shared/main/index.tsx @@ -641,6 +641,10 @@ function TabChatButton({ }) { const { chat } = useShell(); const currentTab = useTabs((state) => state.currentTab); + const isChatOpen = + chat.mode === "FloatingOpen" || chat.mode === "RightPanelOpen"; + const isRightPanelOpen = chat.mode === "RightPanelOpen"; + const isTabbarSelected = placement === "tabbar" && isChatOpen; const { data: isChatEnabled } = useQuery({ refetchInterval: 10_000, @@ -658,7 +662,11 @@ function TabChatButton({ return null; } - if (chat.mode === "RightPanelOpen" || chat.mode === "FullTab") { + if (chat.mode === "FullTab") { + return null; + } + + if (placement !== "tabbar" && isRightPanelOpen) { return null; } @@ -671,29 +679,40 @@ function TabChatButton({ return null; } - const handleOpen = () => chat.sendEvent({ type: "OPEN" }); + const buttonTitle = isTabbarSelected ? "Close chat" : "Chat with notes"; + + const handleClick = () => + chat.sendEvent(isTabbarSelected ? { type: "TOGGLE" } : { type: "OPEN" }); if (placement === "tabbar") { return ( - Chat with notes + {buttonTitle} {shortcutLabel && ( {shortcutLabel} )}