mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-20 21:01:36 +03:00
f952d7a269
* feat(v2): loaders added * feature: Add scroll animations * feature: upload ui * feature: upload multiple files * fix: Same file name and size remove * feat(crawler): added * feat(parsers): v2 added more * feat(v2): audio now working * feat(v2): all loaders * feat(v2): explorer * chore: add links * feat(api): added status in return message * refactor(website): remove old code * feat(upload): return type for messages * feature: redirect to upload if ENV=local * fix(chat): fixed some issues * feature: respect response type * loading state * feature: Loading stat * feat(v2): added explore and chat pages * feature: modal settings * style: Chat UI * feature: scroll to bottom when chatting * feature: smooth scroll in chat * feature(anim): Slide chat in * feature: markdown chat * feat(explorer): list * feat(doc): added document item * feat(explore): added modal * Add clarification on Project API keys and web interface for migration scripts to Readme (#58) * fix(demo): changed link * add support to uploading zip file (#62) * Catch UnicodeEncodeError exception (#64) * feature: fixed chatbar * fix(loaders): missing argument * fix: layout * fix: One whole chatbox * fix: Scroll into view * fix(build): vercel issues * chore(streamlit): moved to own file * refactor(api): moved to backend folder * feat(docker): added docker compose * Fix a bug where langchain memories were not being cleaned (#71) * Update README.md (#70) * chore(streamlit): moved to own file * refactor(api): moved to backend folder * docs(readme): updated for new version * docs(readme): added old readme * docs(readme): update copy dot env file * docs(readme): cleanup --------- Co-authored-by: iMADi-ARCH <nandanaditya985@gmail.com> Co-authored-by: Matt LeBel <github@lebel.io> Co-authored-by: Evan Carlson <45178375+EvanCarlson@users.noreply.github.com> Co-authored-by: Mustafa Hasan Khan <65130881+mustafahasankhan@users.noreply.github.com> Co-authored-by: zhulixi <48713110+zlxxlz1026@users.noreply.github.com> Co-authored-by: Stanisław Tuszyński <stanislaw@tuszynski.me>
79 lines
2.9 KiB
TypeScript
79 lines
2.9 KiB
TypeScript
"use client";
|
|
import { FC, ReactNode, useState } from "react";
|
|
import * as Dialog from "@radix-ui/react-dialog";
|
|
import { MdClose } from "react-icons/md";
|
|
import { AnimatePresence, motion } from "framer-motion";
|
|
import Button from "./Button";
|
|
|
|
interface ModalProps {
|
|
title: string;
|
|
desc: string;
|
|
children?: ReactNode;
|
|
Trigger: ReactNode;
|
|
}
|
|
|
|
const Modal: FC<ModalProps> = ({ title, desc, children, Trigger }) => {
|
|
const [open, setOpen] = useState(false);
|
|
return (
|
|
<Dialog.Root onOpenChange={setOpen}>
|
|
<Dialog.Trigger asChild>
|
|
{Trigger}
|
|
{/* <button className="text-violet11 shadow-blackA7 hover:bg-mauve3 inline-flex h-[35px] items-center justify-center rounded-[4px] bg-white px-[15px] font-medium leading-none shadow-[0_2px_10px] focus:shadow-[0_0_0_2px] focus:shadow-black focus:outline-none">
|
|
Edit profile
|
|
</button> */}
|
|
</Dialog.Trigger>
|
|
<AnimatePresence>
|
|
{open ? (
|
|
<Dialog.Portal forceMount>
|
|
<Dialog.Overlay asChild forceMount>
|
|
<motion.div
|
|
className="fixed inset-0 flex items-center justify-center overflow-auto cursor-pointer bg-black/50 backdrop-blur-sm"
|
|
initial={{ opacity: 0 }}
|
|
animate={{ opacity: 1 }}
|
|
exit={{ opacity: 0 }}
|
|
// transition={{ duration: 0.4, ease: "easeInOut" }}
|
|
>
|
|
<Dialog.Content asChild forceMount>
|
|
<motion.div
|
|
initial={{ opacity: 0, y: "-40%" }}
|
|
animate={{ opacity: 1, y: "0%" }}
|
|
exit={{ opacity: 0, y: "40%" }}
|
|
className="w-[90vw] flex flex-col max-w-lg rounded bg-white p-10 shadow-xl focus:outline-none cursor-auto"
|
|
>
|
|
<Dialog.Title className="m-0 text-2xl font-bold">
|
|
{title}
|
|
</Dialog.Title>
|
|
|
|
<Dialog.Description className="opacity-50">
|
|
{desc}
|
|
</Dialog.Description>
|
|
|
|
{children}
|
|
|
|
<Dialog.Close asChild>
|
|
<Button variant={"secondary"} className="self-end">
|
|
Done
|
|
</Button>
|
|
</Dialog.Close>
|
|
|
|
<Dialog.Close asChild>
|
|
<button
|
|
className="absolute top-0 p-5 right-0 inline-flex appearance-none items-center justify-center rounded-full focus:shadow-sm focus:outline-none"
|
|
aria-label="Close"
|
|
>
|
|
<MdClose />
|
|
</button>
|
|
</Dialog.Close>
|
|
</motion.div>
|
|
</Dialog.Content>
|
|
</motion.div>
|
|
</Dialog.Overlay>
|
|
</Dialog.Portal>
|
|
) : null}
|
|
</AnimatePresence>
|
|
</Dialog.Root>
|
|
);
|
|
};
|
|
|
|
export default Modal;
|