From 7300cc83409e0950f6ead5ad7865cc0a4b2d6bfb Mon Sep 17 00:00:00 2001 From: Isaac Light Date: Tue, 11 Jun 2024 20:42:18 -0400 Subject: [PATCH] adding edit/delete parts buttons --- frontend/src/pages/PartDetails.tsx | 81 ++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/frontend/src/pages/PartDetails.tsx b/frontend/src/pages/PartDetails.tsx index 6edacb68..340cffb5 100644 --- a/frontend/src/pages/PartDetails.tsx +++ b/frontend/src/pages/PartDetails.tsx @@ -27,16 +27,21 @@ const PartDetails = () => { const { addAlert } = useAlertQueue(); const auth = useAuthentication(); const auth_api = new api(auth.api); + const [userId, setUserId] = useState(null); const { id } = useParams(); const [show, setShow] = useState(false); const [ownerEmail, setOwnerEmail] = useState(null); const [part, setPart] = useState(null); const [imageIndex, setImageIndex] = useState(0); const [error, setError] = useState(null); + const [showDelete, setShowDelete] = useState(false); const handleClose = () => setShow(false); const handleShow = () => setShow(true); + const handleShowDelete = () => setShowDelete(true); + const handleCloseDelete = () => setShowDelete(false); + useEffect(() => { const fetchPart = async () => { try { @@ -219,6 +224,82 @@ const PartDetails = () => { + <> + {/* {part.owner === userId && ( */} + {part.owner === part.owner && ( + <> + + + + + + + + + + + + Are you sure you want to delete this part? + + + + + + + + + )} + ); };