diff --git a/src/pages/workspaces/components/CreateDialog.tsx b/src/pages/workspaces/components/CreateDialog.tsx new file mode 100644 index 0000000..1c3ecd7 --- /dev/null +++ b/src/pages/workspaces/components/CreateDialog.tsx @@ -0,0 +1,105 @@ +import { useState } from "react"; +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { Textarea } from "@/components/ui/textarea"; +import { TagInput } from "./TagInput"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, +} from "@/components/ui/dialog"; + +export function CreateDialog({ open, onClose, onSubmit }: { + open: boolean; + onClose: () => void; + onSubmit: (data: { title: string, tags?: string[], link?: string, summary?: string, description?: string }) => Promise; +}) { + const [title, setTitle] = useState(''); + const [tags, setTags] = useState([]); + const [link, setLink] = useState(''); + const [summary, setSummary] = useState(''); + const [description, setDescription] = useState(''); + const [submitting, setSubmitting] = useState(false); + + const handleSubmit = async () => { + if (!title.trim()) { + alert('请输入标题'); + return; + } + setSubmitting(true); + try { + await onSubmit({ + title: title.trim(), + tags, + link: link.trim(), + summary: summary.trim(), + description: description.trim(), + }); + } finally { + setSubmitting(false); + } + }; + + return ( + !open && onClose()}> + + + 创建Workspace + 填写以下信息创建一个新的Workspace + +
+
+ + setTitle(e.target.value)} + placeholder="请输入标题" + /> +
+
+ + +
+
+ + setLink(e.target.value)} + placeholder="https://..." + /> +
+
+ + setSummary(e.target.value)} + placeholder="简要描述" + /> +
+
+ +