diff --git a/client/src/common/menus.ts b/client/src/common/menus.ts index ee7d7292c90..1aeb70d6440 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 c91d30543f0..dc1789a18de 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" > -