diff --git a/archon-ui-main/src/features/projects/components/NewProjectModal.tsx b/archon-ui-main/src/features/projects/components/NewProjectModal.tsx new file mode 100644 index 00000000..4e9a0157 --- /dev/null +++ b/archon-ui-main/src/features/projects/components/NewProjectModal.tsx @@ -0,0 +1,154 @@ +import React, { useState } from 'react'; +import { Loader2 } from 'lucide-react'; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, + DialogDescription, + DialogFooter, +} from '../../ui/primitives/dialog'; +import { Button } from '../../ui/primitives/button'; +import { Input } from '../../ui/primitives/input'; +import { cn } from '../../ui/primitives/styles'; +import { useCreateProject } from '../hooks/useProjectQueries'; +import type { CreateProjectRequest } from '../../../types/project'; + +interface NewProjectModalProps { + open: boolean; + onOpenChange: (open: boolean) => void; + onSuccess?: () => void; +} + +export const NewProjectModal: React.FC = ({ + open, + onOpenChange, + onSuccess, +}) => { + const [formData, setFormData] = useState({ + title: '', + description: '', + }); + + const createProjectMutation = useCreateProject(); + + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + + if (!formData.title.trim()) return; + + createProjectMutation.mutate(formData, { + onSuccess: () => { + setFormData({ title: '', description: '' }); + onOpenChange(false); + onSuccess?.(); + }, + }); + }; + + const handleClose = () => { + if (!createProjectMutation.isPending) { + setFormData({ title: '', description: '' }); + onOpenChange(false); + } + }; + + return ( + + +
+ + + Create New Project + + + Start a new project to organize your tasks and documents. + + + +
+
+ + + setFormData((prev) => ({ ...prev, title: e.target.value })) + } + disabled={createProjectMutation.isPending} + className={cn( + "w-full", + "focus:border-purple-400 focus:shadow-[0_0_10px_rgba(168,85,247,0.2)]" + )} + autoFocus + /> +
+ +
+ +