import { useState } from "react"; import { Button } from "@/components/ui/button"; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "@/components/ui/dialog"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Textarea } from "@/components/ui/textarea"; import { useCreateFolderMutation } from "../hooks/useFolderMutations"; interface CreateFolderDialogProps { open: boolean; onOpenChange: (open: boolean) => void; } function CreateFolderDialog({ open, onOpenChange }: CreateFolderDialogProps) { const [title, setTitle] = useState(""); const [description, setDescription] = useState(""); const createFolderMutation = useCreateFolderMutation(); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); if (!title.trim()) return; await createFolderMutation.mutateAsync({ title: title.trim(), description: description.trim() || null, }); setTitle(""); setDescription(""); onOpenChange(false); }; const handleOpenChange = (open: boolean) => { onOpenChange(open); if (!open) { setTitle(""); setDescription(""); } }; return ( Create New Folder Create a folder to organize your workflows.
setTitle(e.target.value)} placeholder="e.g., Production Workflows" autoFocus />