π§© Feature / Task
Add "Edit" and "Delete" options to the hackathon listings on the user's dashboard. These options should only be visible to the original uploader of the hackathon, allowing them to manage their own submissions.
β
Acceptance Criteria
π§ Steps To Do
- In
public/dashboard.html (or in the JavaScript that renders hackathon cards), add HTML for "Edit" and "Delete" buttons to each hackathon listing.
- In
scripts/features/dashboard.js (when rendering hackathons), add a conditional check: if (hackathon.creatorId === currentUserId) { /* show edit/delete buttons */ }.
- For "Edit":
- Attach an event listener to the "Edit" button.
- When clicked, navigate to
public/upload.html and pass the hackathon ID as a URL parameter (e.g., upload.html?id=hackathonId).
- In
upload.html (or uploadHackathon.js), check for this ID and if present, fetch the hackathon data from Firestore and pre-fill the form.
- For "Delete":
- Attach an event listener to the "Delete" button.
- Prompt the user for confirmation (e.g.,
confirm('Are you sure you want to delete this hackathon?')).
- If confirmed, use
firebase.firestore().collection('hackathons').doc(hackathonId).delete() to remove the document.
- Refresh the displayed list of hackathons after deletion.
π Related Files / Areas
public/dashboard.html
public/upload.html
scripts/features/dashboard.js
scripts/features/uploadHackathon.js (for edit pre-fill logic)
- Firebase:
Firestore
π§© Priority
Priority: π‘ Medium
π Dependencies
Depends on: #24, #21
πΌοΈ Reference
π§© Feature / Task
Add "Edit" and "Delete" options to the hackathon listings on the user's dashboard. These options should only be visible to the original uploader of the hackathon, allowing them to manage their own submissions.
β Acceptance Criteria
public/dashboard.htmlhas "Edit" and "Delete" buttons/links.creatorIdof the hackathon matches the ID of the currently logged-in user.π§ Steps To Do
public/dashboard.html(or in the JavaScript that renders hackathon cards), add HTML for "Edit" and "Delete" buttons to each hackathon listing.scripts/features/dashboard.js(when rendering hackathons), add a conditional check:if (hackathon.creatorId === currentUserId) { /* show edit/delete buttons */ }.public/upload.htmland pass the hackathon ID as a URL parameter (e.g.,upload.html?id=hackathonId).upload.html(oruploadHackathon.js), check for this ID and if present, fetch the hackathon data from Firestore and pre-fill the form.confirm('Are you sure you want to delete this hackathon?')).firebase.firestore().collection('hackathons').doc(hackathonId).delete()to remove the document.π Related Files / Areas
public/dashboard.htmlpublic/upload.htmlscripts/features/dashboard.jsscripts/features/uploadHackathon.js(for edit pre-fill logic)Firestoreπ§© Priority
Priority: π‘ Medium
π Dependencies
Depends on: #24, #21
πΌοΈ Reference