import { getCanvasData } from "@/app/actions/fetchers"; import { AnimatePresence, motion } from "framer-motion"; import Link from "next/link"; import { EllipsisHorizontalCircleIcon, TrashIcon, PencilSquareIcon, } from "@heroicons/react/24/outline"; import { toast } from "sonner"; import { Label } from "@repo/ui/shadcn/label"; const childVariants = { hidden: { opacity: 0, y: 10, filter: "blur(2px)" }, visible: { opacity: 1, y: 0, filter: "blur(0px)" }, }; export default function ThinkPad({ title, description, image, id, }: { title: string; description: string; image: string; id: string; }) { const [deleted, setDeleted] = useState(false); const [info, setInfo] = useState({ title, description }); return ( {!deleted && ( Loading... } >
{info.title} {info.description}
setDeleted(true)} setInfo={(e) => setInfo(e)} /> )} ); } import { Popover, PopoverContent, PopoverTrigger, } from "@repo/ui/shadcn/popover"; function Menu({ info, id, setDeleted, setInfo, }: { info: { title: string; description: string }; id: string; setDeleted: () => void; setInfo: ({ title, description, }: { title: string; description: string; }) => void; }) { return ( ); } function EditToolbar({ id, setInfo, info, }: { id: string; setInfo: ({ title, description, }: { title: string; description: string; }) => void; info: { title: string; description: string; }; }) { const [open, setOpen] = useState(false); return (
{ const data = { title: FormData.get("title") as string, description: FormData.get("description") as string, }; const res = await AddCanvasInfo({ id, ...data }); if (res.success) { setOpen(false); setInfo(data); } else { setOpen(false); toast.error("Something went wrong.", { style: { backgroundColor: "rgb(22 31 42 / 0.3)" }, }); } }} > Edit Canvas Add Description to your canvas. Pro tip: Let AI do the job, as you add your content into canvas, we will autogenerate your description.