import React from 'react'; import { useState } from 'react'; import { useLocation } from 'react-router-dom'; import type { TConversation } from 'librechat-data-provider'; import { Download } from 'lucide-react'; import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from '~/components/ui'; import { useLocalize } from '~/hooks'; import { ExportModal } from '../Nav'; import { useRecoilValue } from 'recoil'; import store from '~/store'; function ExportButton() { const localize = useLocalize(); const location = useLocation(); const [showExports, setShowExports] = useState(false); const activeConvo = useRecoilValue(store.conversationByIndex(0)); const globalConvo = useRecoilValue(store.conversation) ?? ({} as TConversation); let conversation: TConversation | null | undefined; if (location.state?.from?.pathname.includes('/chat')) { conversation = globalConvo; } else { conversation = activeConvo; } const clickHandler = () => { if (exportable) { setShowExports(true); } }; const exportable = conversation && conversation.conversationId && conversation.conversationId !== 'new' && conversation.conversationId !== 'search'; return ( <> {exportable && (