import { useMemo } from "react"; import { motion } from "framer-motion"; import Image from "next/image"; import { arrayBufferToBase64 } from "@/utils"; import { useCollection } from "./useCollection"; interface Props { id: string; onClose: () => void; } const dropIn = { hidden: { opacity: 0, }, visible: { y: "0", opacity: 1, transition: { duration: 0.1, type: "spring", damping: 25, stiffness: 500, }, }, exit: { opacity: 0, }, }; export const Modal: React.FC = ({ id, onClose }) => { const { collection } = useCollection(id); if (!collection) return null; const formatDate = useMemo(() => { if (!collection) return; const date = new Date(collection.createdAt); return date.toLocaleDateString(); }, [collection?.createdAt]); return ( e.stopPropagation()} className="max-w-2xl h-auto w-full z-[1] rounded-3xl overflow-hidden flex items-center justify-center flex-col gap-4 bg-white/30 backdrop-blur-sm px-2 pb-2 pt-2" variants={dropIn} initial="hidden" animate="visible" exit="exit" > Generated image

{formatDate}

{collection.prompt}

); };