From 208538f9301030556625fe37e27b3a8df08c5101 Mon Sep 17 00:00:00 2001 From: zhi Date: Tue, 17 Mar 2026 14:05:31 +0000 Subject: [PATCH] =?UTF-8?q?feat(propose):=20P10.7=20edit=20modal=20for=20o?= =?UTF-8?q?pen=20proposes=20=E2=80=94=20title+description=20editable,=20hi?= =?UTF-8?q?dden=20for=20accepted/rejected?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/ProposeDetailPage.tsx | 75 +++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/src/pages/ProposeDetailPage.tsx b/src/pages/ProposeDetailPage.tsx index f9ad52e..5f5b7c0 100644 --- a/src/pages/ProposeDetailPage.tsx +++ b/src/pages/ProposeDetailPage.tsx @@ -17,6 +17,12 @@ export default function ProposeDetailPage() { const [actionLoading, setActionLoading] = useState(false) const [error, setError] = useState('') + // Edit state (P10.7) + const [showEdit, setShowEdit] = useState(false) + const [editTitle, setEditTitle] = useState('') + const [editDescription, setEditDescription] = useState('') + const [editLoading, setEditLoading] = useState(false) + const fetchPropose = () => { if (!projectId) return api.get(`/projects/${projectId}/proposes/${id}`).then(({ data }) => setPropose(data)) @@ -62,6 +68,32 @@ export default function ProposeDetailPage() { } } + const openEditModal = () => { + if (!propose) return + setEditTitle(propose.title) + setEditDescription(propose.description || '') + setError('') + setShowEdit(true) + } + + const handleEdit = async () => { + if (!projectId) return + setEditLoading(true) + setError('') + try { + await api.patch(`/projects/${projectId}/proposes/${id}`, { + title: editTitle, + description: editDescription, + }) + setShowEdit(false) + fetchPropose() + } catch (err: any) { + setError(err.response?.data?.detail || 'Update failed') + } finally { + setEditLoading(false) + } + } + const handleReopen = async () => { if (!projectId) return setActionLoading(true) @@ -122,6 +154,12 @@ export default function ProposeDetailPage() {
{propose.status === 'open' && ( <> +