2024-01-31 00:34:32 +03:00
|
|
|
import { AnimatePresence, motion } from "framer-motion";
|
|
|
|
|
|
|
|
import { KnowledgeToFeed } from "@/app/chat/[chatId]/components/ActionsBar/components";
|
|
|
|
import { useActionBar } from "@/app/chat/[chatId]/components/ActionsBar/hooks/useActionBar";
|
|
|
|
import { useKnowledgeToFeedContext } from "@/lib/context/KnowledgeToFeedProvider/hooks/useKnowledgeToFeedContext";
|
|
|
|
|
|
|
|
import styles from "./UploadDocumentModal.module.scss";
|
|
|
|
|
2024-02-07 03:05:07 +03:00
|
|
|
import { Modal } from "../ui/Modal";
|
|
|
|
|
2024-01-31 00:34:32 +03:00
|
|
|
export const UploadDocumentModal = (): JSX.Element => {
|
2024-02-07 03:05:07 +03:00
|
|
|
const { shouldDisplayFeedCard, setShouldDisplayFeedCard } =
|
|
|
|
useKnowledgeToFeedContext();
|
2024-01-31 00:34:32 +03:00
|
|
|
const { setHasPendingRequests } = useActionBar();
|
|
|
|
|
|
|
|
if (!shouldDisplayFeedCard) {
|
|
|
|
return <></>;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2024-02-07 03:05:07 +03:00
|
|
|
<Modal
|
|
|
|
isOpen={shouldDisplayFeedCard}
|
|
|
|
setOpen={setShouldDisplayFeedCard}
|
|
|
|
CloseTrigger={<div />}
|
|
|
|
>
|
|
|
|
<div className={styles.knowledge_modal}>
|
|
|
|
<AnimatePresence>
|
|
|
|
<motion.div
|
|
|
|
key="slide"
|
|
|
|
initial={{ y: "100%", opacity: 0 }}
|
|
|
|
animate={{ y: 0, opacity: 1, transition: { duration: 0.2 } }}
|
|
|
|
exit={{ y: "100%", opacity: 0 }}
|
|
|
|
>
|
|
|
|
<KnowledgeToFeed
|
|
|
|
dispatchHasPendingRequests={() => setHasPendingRequests(true)}
|
|
|
|
/>
|
|
|
|
</motion.div>
|
|
|
|
</AnimatePresence>
|
|
|
|
</div>
|
|
|
|
</Modal>
|
2024-01-31 00:34:32 +03:00
|
|
|
);
|
|
|
|
};
|