import { useState } from "react"; import { Loader2, Layers } from "lucide-react"; import { Dialog, DialogContent, DialogOverlay } from "~/components/ui/dialog"; import { Button } from "~/components/ui/button"; import { Input } from "~/components/ui/input"; import { useCreateCollection } from "../../requestHandler/use-user-collection-hooks"; import { UserCollection } from "../../../src/api/types"; interface CreateSetModalProps { isOpen: boolean; onOpenChange: (open: boolean) => void; productId: string; onSuccess: (collection: UserCollection) => void; } export const CreateSetModal = ({ isOpen, onOpenChange, productId, onSuccess, }: CreateSetModalProps) => { const [title, setTitle] = useState(""); const [description, setDescription] = useState(""); const { mutate: createCollection, isPending } = useCreateCollection(); const handleCreate = () => { if (!title.trim()) return; createCollection( { title: title.trim(), description: description.trim() || undefined, productIds: [productId], }, { onSuccess: (data) => { setTitle(""); setDescription(""); onSuccess(data); }, } ); }; const handleClose = () => { setTitle(""); setDescription(""); onOpenChange(false); }; return (

ایجاد ست جدید

یک ست جدید بسازید و محصولات مورد علاقه‌تان را در آن جمع‌آوری کنید

setTitle(e.target.value)} className="w-full" maxLength={100} />
setDescription(e.target.value)} className="w-full" maxLength={500} />
); };