diff --git a/apps/web/app/components/CreateIssueForm.tsx b/apps/web/app/components/CreateIssueForm.tsx deleted file mode 100644 index 166ef542f..000000000 --- a/apps/web/app/components/CreateIssueForm.tsx +++ /dev/null @@ -1,145 +0,0 @@ -'use client'; - -import { useState } from 'react'; - -const API_BASE = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000'; - -interface CreateIssueFormProps { - taskId: string; - projectId: string; - onSuccess: () => void; - onCancel: () => void; -} - -export default function CreateIssueForm({ taskId, projectId, onSuccess, onCancel }: CreateIssueFormProps) { - const [loading, setLoading] = useState(false); - const [error, setError] = useState(''); - const [formData, setFormData] = useState({ - title: '', - description: '', - }); - - const handleSubmit = async (e: React.FormEvent) => { - e.preventDefault(); - setLoading(true); - setError(''); - - try { - const res = await fetch(`${API_BASE}/api/v1/project-management/issues`, { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ - task_id: taskId, - project_id: projectId, - ...formData, - }), - }); - - if (!res.ok) { - const data = await res.json(); - throw new Error(data.detail || '创建失败'); - } - - onSuccess(); - } catch (err: unknown) { - setError(err instanceof Error ? err.message : String(err)); - } finally { - setLoading(false); - } - }; - - return ( -
- {error && ( -
- {error} -
- )} - -
- - setFormData({ ...formData, title: e.target.value })} - style={{ - width: '100%', - padding: '8px 12px', - border: '1px solid var(--border)', - borderRadius: '4px', - fontSize: '14px', - }} - placeholder="简要描述问题" - /> -
- -
- -