Skip to content

Add Edit/Delete Options for OwnerΒ #25

@yuvraj-rathod-1202

Description

@yuvraj-rathod-1202

🧩 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

  • Each hackathon listed on public/dashboard.html has "Edit" and "Delete" buttons/links.
  • These buttons are only displayed if the creatorId of the hackathon matches the ID of the currently logged-in user.
  • Clicking "Edit" redirects the user to the upload form with the hackathon's existing data pre-filled.
  • Clicking "Delete" prompts for confirmation and then removes the hackathon from Firestore.

🚧 Steps To Do

  1. In public/dashboard.html (or in the JavaScript that renders hackathon cards), add HTML for "Edit" and "Delete" buttons to each hackathon listing.
  2. In scripts/features/dashboard.js (when rendering hackathons), add a conditional check: if (hackathon.creatorId === currentUserId) { /* show edit/delete buttons */ }.
  3. 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.
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions