mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 08:12:00 +02:00

* build/refactor: move lint/prettier packages to project root, install husky, add pre-commit hook * refactor: reformat files * build: put full eslintrc back with all rules
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
import React, { useState } from 'react';
|
|
import { useRecoilValue } from 'recoil';
|
|
import { Download } from 'lucide-react';
|
|
import { cn } from '~/utils/';
|
|
|
|
import ExportModel from './ExportModel';
|
|
|
|
import store from '~/store';
|
|
|
|
export default function ExportConversation() {
|
|
const [open, setOpen] = useState(false);
|
|
|
|
const conversation = useRecoilValue(store.conversation) || {};
|
|
|
|
const exportable =
|
|
conversation?.conversationId &&
|
|
conversation?.conversationId !== 'new' &&
|
|
conversation?.conversationId !== 'search';
|
|
|
|
const clickHandler = () => {
|
|
if (exportable) setOpen(true);
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<button
|
|
className={cn(
|
|
'flex w-full cursor-pointer items-center gap-3 px-3 py-3 text-sm text-white transition-colors duration-200 hover:bg-gray-700',
|
|
exportable ? 'cursor-pointer text-white' : 'cursor-not-allowed text-gray-400'
|
|
)}
|
|
onClick={clickHandler}
|
|
>
|
|
<Download size={16} />
|
|
Export conversation
|
|
</button>
|
|
|
|
<ExportModel open={open} onOpenChange={setOpen} />
|
|
</>
|
|
);
|
|
}
|