mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
🐛 fix: Resolve Preset Button Disappearing in Mobile View (#2935)
* refactor: Update import paths for ExportAndShareMenu component and add localization * fix: mobile view for export/share button
This commit is contained in:
parent
b8e35002f4
commit
248dfb8b5b
4 changed files with 20 additions and 19 deletions
|
|
@ -1,26 +1,18 @@
|
|||
import { useState } from 'react';
|
||||
import { Upload } from 'lucide-react';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import type { TConversation } from 'librechat-data-provider';
|
||||
import DropDownMenu from '../Conversations/DropDownMenu';
|
||||
import ShareButton from '../Conversations/ShareButton';
|
||||
import HoverToggle from '../Conversations/HoverToggle';
|
||||
import DropDownMenu from '~/components/Conversations/DropDownMenu';
|
||||
import ShareButton from '~/components/Conversations/ShareButton';
|
||||
import HoverToggle from '~/components/Conversations/HoverToggle';
|
||||
import useLocalize from '~/hooks/useLocalize';
|
||||
import ExportButton from './ExportButton';
|
||||
import store from '~/store';
|
||||
|
||||
export default function ExportAndShareMenu() {
|
||||
const location = useLocation();
|
||||
export default function ExportAndShareMenu({ className = '' }: { className?: string }) {
|
||||
const localize = useLocalize();
|
||||
|
||||
const activeConvo = useRecoilValue(store.conversationByIndex(0));
|
||||
const globalConvo = useRecoilValue(store.conversation) ?? ({} as TConversation);
|
||||
const conversation = useRecoilValue(store.conversationByIndex(0));
|
||||
const [isPopoverActive, setIsPopoverActive] = useState(false);
|
||||
let conversation: TConversation | null | undefined;
|
||||
if (location.state?.from?.pathname.includes('/chat')) {
|
||||
conversation = globalConvo;
|
||||
} else {
|
||||
conversation = activeConvo;
|
||||
}
|
||||
|
||||
const exportable =
|
||||
conversation &&
|
||||
|
|
@ -29,7 +21,7 @@ export default function ExportAndShareMenu() {
|
|||
conversation.conversationId !== 'search';
|
||||
|
||||
if (!exportable) {
|
||||
return <></>;
|
||||
return null;
|
||||
}
|
||||
|
||||
const isActiveConvo = exportable;
|
||||
|
|
@ -39,10 +31,11 @@ export default function ExportAndShareMenu() {
|
|||
isActiveConvo={!!isActiveConvo}
|
||||
isPopoverActive={isPopoverActive}
|
||||
setIsPopoverActive={setIsPopoverActive}
|
||||
className={className}
|
||||
>
|
||||
<DropDownMenu
|
||||
icon={<Upload />}
|
||||
tooltip="Export/Share"
|
||||
tooltip={localize('com_endpoint_export_share')}
|
||||
className="pointer-cursor relative z-50 flex h-[40px] min-w-4 flex-none flex-col items-center justify-center rounded-md border border-gray-100 bg-white px-3 text-left hover:bg-gray-50 focus:outline-none focus:ring-0 focus:ring-offset-0 radix-state-open:bg-gray-50 dark:border-gray-700 dark:bg-gray-800 dark:hover:bg-gray-700 dark:radix-state-open:bg-gray-700 sm:text-sm"
|
||||
>
|
||||
{conversation && conversation.conversationId && (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue