From 98ba64e35c3b5048826f5e5c785e4a101e693995 Mon Sep 17 00:00:00 2001 From: Zhi Date: Thu, 12 Mar 2026 12:06:46 +0000 Subject: [PATCH] feat: add repo field to Project --- src/pages/ProjectDetailPage.tsx | 3 ++- src/pages/ProjectsPage.tsx | 8 ++++++-- src/types/index.ts | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/pages/ProjectDetailPage.tsx b/src/pages/ProjectDetailPage.tsx index 6cdaa12..12aae2f 100644 --- a/src/pages/ProjectDetailPage.tsx +++ b/src/pages/ProjectDetailPage.tsx @@ -19,13 +19,14 @@ export default function ProjectDetailPage() { const [users, setUsers] = useState([]) const [roles, setRoles] = useState([]) const [editing, setEditing] = useState(false) - const [editForm, setEditForm] = useState({ owner: '', description: '', sub_projects: [] as string[], related_projects: [] as string[] }) + const [editForm, setEditForm] = useState({ owner: '', repo: '', description: '', sub_projects: [] as string[], related_projects: [] as string[] }) useEffect(() => { api.get(`/projects/${id}`).then(({ data }) => { setProject(data) setEditForm({ owner: data.owner || '', + repo: data.repo || '', description: data.description || '', sub_projects: data.sub_projects || [], related_projects: data.related_projects || [], diff --git a/src/pages/ProjectsPage.tsx b/src/pages/ProjectsPage.tsx index 20f8e3b..e34d320 100644 --- a/src/pages/ProjectsPage.tsx +++ b/src/pages/ProjectsPage.tsx @@ -8,7 +8,7 @@ export default function ProjectsPage() { const [projects, setProjects] = useState([]) const [users, setUsers] = useState([]) const [showCreate, setShowCreate] = useState(false) - const [form, setForm] = useState({ name: '', description: '', owner_id: 1, sub_projects: [] as string[], related_projects: [] as string[] }) + const [form, setForm] = useState({ name: '', description: '', owner_id: 1, repo: '', sub_projects: [] as string[], related_projects: [] as string[] }) const navigate = useNavigate() const fetchProjects = () => { @@ -30,7 +30,7 @@ export default function ProjectsPage() { const createProject = async (e: React.FormEvent) => { e.preventDefault() await api.post('/projects', form) - setForm({ name: '', description: '', owner_id: 1, sub_projects: [], related_projects: [] }) + setForm({ name: '', description: '', owner_id: 1, repo: '', sub_projects: [], related_projects: [] }) setShowCreate(false) fetchProjects() } @@ -61,6 +61,10 @@ export default function ProjectsPage() { placeholder="Description (optional)" value={form.description} onChange={(e) => setForm({ ...form, description: e.target.value })} /> + setForm({ ...form, repo: e.target.value })} + />