refactor(Nav/Conversation): reorganize imports and fix import paths

This commit is contained in:
Danny Avila 2023-07-27 10:11:57 -04:00 committed by Danny Avila
parent 4898f7489b
commit dd8bc39001
10 changed files with 42 additions and 25 deletions

View file

@ -0,0 +1,46 @@
import { useState, forwardRef } from 'react';
import { useRecoilValue } from 'recoil';
import { Download } from 'lucide-react';
import { cn } from '~/utils/';
import ExportModel from './ExportModel';
import store from '~/store';
import { localize } from '~/localization/Translation';
const ExportConversation = forwardRef(() => {
const [open, setOpen] = useState(false);
const lang = useRecoilValue(store.lang);
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} />
{localize(lang, 'com_nav_export_conversation')}
</button>
<ExportModel open={open} onOpenChange={setOpen} />
</>
);
});
export default ExportConversation;