From b56de235f912140eda4699e610253ed2cae63f2f Mon Sep 17 00:00:00 2001 From: Marco Beretta <81851188+berry-13@users.noreply.github.com> Date: Mon, 5 Oct 2026 21:36:30 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9A=99=EF=B8=8F=20feat:=20Move=20Chat=20Acti?= =?UTF-8?q?ons=20Into=20a=20Header=20Options=20Menu=20(#16775)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Move Chat Actions Into a Header Options Menu The header's export/share button becomes a chat options menu with Share, Export, Rename, Pin, Change project, Remove from project, Duplicate, Archive and Delete for the open chat. The sidebar row menu keeps Pin, Mark unread, Rename, Archive and Delete. * fix: Address Review Findings on the Header Chat Options Menu Limit read-only subagent threads to share and export, apply the sidebar's rename gate for running chats, let an unchanged title claim ownership, keep later navigation after a late archive, hide history-only actions for temporary chats, expose dialog semantics on the dialog items, and fix import sorting. * fix: Scope Header Chat Option Dialogs to the Conversation They Opened For ChatView stays mounted across a route change, so dialog flags now carry the conversation id they were opened for and reset when the open chat or the read-only state changes. * fix: Settle Header Delete and Rename Dialogs Against the Open Chat Read the open route when a delete settles, give the delete dialog the id its menu item controls, return focus to the menu item when a rename saves, and only let a close clear the dialog it belongs to. * fix: Ignore a Late Rename Result After the Dialog Is Gone A rename that settles after its dialog unmounted no longer closes the parent state or moves focus to the reused menu item. * fix: Dismiss Header Chat Options When the Route Leaves Their Chat The route moves before the chat state does and the menu and dialogs are portaled outside the hidden pane, so they are now dismissed on a route change and gated on it. A delete that settles after another chat opened no longer closes that chat's menu, and the options read the freshest cached copy of the chat instead of an older point entry. --- client/src/common/menus.ts | 2 + .../components/Chat/ExportAndShareMenu.tsx | 16 +- client/src/components/Chat/Header.tsx | 6 +- .../src/components/Chat/Menus/HeaderMenu.tsx | 11 +- .../Chat/Menus/__tests__/HeaderMenu.spec.tsx | 4 +- client/src/components/Chat/Rename.tsx | 140 ++++++ .../__tests__/ExportAndShareMenu.test.tsx | 43 +- .../components/Chat/__tests__/Rename.spec.tsx | 153 ++++++ client/src/components/Conversations/Convo.tsx | 1 - .../components/Conversations/ConvoActions.tsx | 1 - .../ConvoOptions/ConvoOptions.tsx | 177 +------ .../ConvoOptions/DeleteButton.tsx | 10 +- .../ConvoOptions/ProjectButton.tsx | 15 +- .../__tests__/DeleteButton.test.tsx | 89 ++++ .../__tests__/pinPointCache.spec.tsx | 39 ++ .../Chat/__tests__/useChatOptions.spec.tsx | 449 ++++++++++++++++++ client/src/hooks/Chat/useChatOptions.tsx | 344 ++++++++++++++ client/src/locales/en/translation.json | 4 +- .../mock/conversation-management.spec.ts | 8 +- e2e/specs/mock/export.spec.ts | 2 +- e2e/specs/mock/mcp-apps.spec.ts | 2 +- e2e/specs/mock/private-text.spec.ts | 4 +- .../shared-undocked-artifacts.spec.ts | 2 +- e2e/specs/mock/shared-links.spec.ts | 6 +- 24 files changed, 1298 insertions(+), 230 deletions(-) create mode 100644 client/src/components/Chat/Rename.tsx create mode 100644 client/src/components/Chat/__tests__/Rename.spec.tsx create mode 100644 client/src/components/Conversations/ConvoOptions/__tests__/DeleteButton.test.tsx create mode 100644 client/src/data-provider/__tests__/pinPointCache.spec.tsx create mode 100644 client/src/hooks/Chat/__tests__/useChatOptions.spec.tsx create mode 100644 client/src/hooks/Chat/useChatOptions.tsx diff --git a/client/src/common/menus.ts b/client/src/common/menus.ts index ee7d7292c9..1aeb70d644 100644 --- a/client/src/common/menus.ts +++ b/client/src/common/menus.ts @@ -15,6 +15,8 @@ export interface MenuItemProps { separate?: boolean; hideOnClick?: boolean; dialog?: React.ReactElement; + ariaHasPopup?: React.AriaAttributes['aria-haspopup']; + ariaControls?: string; ariaLabel?: string; ariaChecked?: boolean; ref?: React.Ref; diff --git a/client/src/components/Chat/ExportAndShareMenu.tsx b/client/src/components/Chat/ExportAndShareMenu.tsx index c91d30543f..dc1789a18d 100644 --- a/client/src/components/Chat/ExportAndShareMenu.tsx +++ b/client/src/components/Chat/ExportAndShareMenu.tsx @@ -1,27 +1,33 @@ import { useState, useId } from 'react'; -import { Share2 } from 'lucide-react'; +import { Ellipsis } from 'lucide-react'; import * as Ariakit from '@ariakit/react'; import { DropdownPopup, TooltipAnchor, useMediaQuery } from '@librechat/client'; -import useExportShare from '~/hooks/Chat/useExportShare'; +import useChatOptions from '~/hooks/Chat/useChatOptions'; import { useLocalize } from '~/hooks'; export default function ExportAndShareMenu({ isSharedButtonEnabled, + readOnly = false, }: { isSharedButtonEnabled: boolean; + readOnly?: boolean; }) { const localize = useLocalize(); const menuId = useId(); const [isPopoverActive, setIsPopoverActive] = useState(false); const isSmallScreen = useMediaQuery('(max-width: 768px)'); - const { show, items, hasSharedLink, dialogs } = useExportShare({ isSharedButtonEnabled }); + const { show, items, hasSharedLink, dialogs } = useChatOptions({ + isSharedButtonEnabled, + readOnly, + closeMenu: () => setIsPopoverActive(false), + }); if (!show) { return null; } const description = localize( - hasSharedLink ? 'com_ui_export_share_link_active' : 'com_endpoint_export_share', + hasSharedLink ? 'com_ui_chat_options_link_active' : 'com_ui_chat_options', ); return ( @@ -42,7 +48,7 @@ export default function ExportAndShareMenu({ aria-label={description} className="border-border-light bg-presentation text-text-primary hover:bg-surface-tertiary aria-expanded:bg-surface-tertiary relative inline-flex size-9 shrink-0 items-center justify-center rounded-xl border transition-all ease-in-out disabled:pointer-events-none disabled:opacity-50" > -