Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete Item Feature #26

Merged
merged 5 commits into from May 13, 2023
Merged

Delete Item Feature #26

merged 5 commits into from May 13, 2023

Conversation

drakenguyen4000
Copy link
Collaborator

@drakenguyen4000 drakenguyen4000 commented May 8, 2023

Co-authored by @yiremorlans

Description

  • We imported deleteDoc from firestore to implement the deleteItem functionality of our App.
  • We created a onDelete helper function that prompts the user on whether they want to delete an item. We achieved that using the confirm method from the window object. We decided on that method over implementing a modal because of accessibility issues that we might have encountered.
  • We learned the difference between an alert box and a confirmation box for our specific use case.

Related Issue

Close #11

Acceptance Criteria

  • The ListItem component renders a button that allows the user to delete an item from their list when clicked
  • Clicking the delete button prompts the user to confirm that they really want to delete the item
  • The deleteItem function in api/firebase.js has been filled out, and deletes the item from the Firestore database

Type of Changes

Type
🐛 Bug fix
✨ New feature
🔨 Refactoring
💯 Add tests
🔗 Update dependencies
📜 Docs

Updates

Before

image

After

image

Testing Steps / QA Criteria

  • To test, you will have to pull the feature branch, test the delete button and check the fire store to see if the item has been deleted.

@github-actions
Copy link

github-actions bot commented May 8, 2023

Visit the preview URL for this PR (updated for commit 9c1ee0d):

https://tcl-56-smart-shopping-li-ffe7d--pr26-ym-dn-delete-item-hmi6jql9.web.app

(expires Thu, 18 May 2023 19:49:17 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 9c51cec5927ae3f1253a2134be95c1a07393f9a7

src/api/firebase.js Outdated Show resolved Hide resolved
Copy link
Collaborator

@ashleyvalentine ashleyvalentine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code is clear and the functionality is good on my end!


const checkItem = (e) => {
updateItem(listId, item);
};
async function handleDelete() {
if (window.confirm('Are you sure you want to delete this item?')) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that you made this decision for accessibility issues versus using an alert box. I'll be keeping this in mind for the future!

@adidalal adidalal merged commit f7c0c2d into main May 13, 2023
2 checks passed
@adidalal adidalal deleted the ym-dn-delete-item branch May 13, 2023 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants