the-collab-lab / tcl-23-smart-shopping-list

1 stars 2 forks source link

Deleting Items from a Shopping List #27

Closed zeeatwork closed 3 years ago

zeeatwork commented 3 years ago

Description

This pull request updates our UI and Firestore database functionality. List.js now includes additional event handling that allows a user to delete a shopping list item. The newly created deleteItem function takes a list item's id as its only parameter, asks the user to confirm their decision to delete an item, then uses the id to delete the item from it's Firestore collection (using Firestore's delete() method.

Read more about implementing the delete method in Firestore here.

Note that, in Firestore, a collection cannot exist without at least one child document. If the user deletes all items from their list, the token disappears from Firestore, but remains in localstorage. The list view also reverts to the UI prompt directing the user to add their first item. When the user adds a new item to the list, the user's token reappears in Firestore without issue or error.

In order to contemplate accessibility features, we switched our app to the updated version of Sweet Alert and updated the alerts in all our pages.

Acceptance Criteria

Related Issue

This PR closes #12

Type of Changes

Type
:bug: Bug fix
:sparkles: New feature
:hammer: Refactoring
:100: Add tests
:link: Update dependencies
:scroll: Docs

Updates

Before

Screen Shot 2021-05-10 at 6 10 05 PM

After

Screen Shot 2021-05-10 at 5 52 43 PM Screen Shot 2021-05-10 at 5 53 29 PM Screen Shot 2021-05-12 at 7 12 43 PM Screen Shot 2021-05-10 at 6 06 20 PM

Testing Steps / QA Criteria

  1. Use GitHub to checkout branch za-ar-delete-items
  2. npm install in order to install the new dependency
  3. npm start the branch using CLI
  4. Create a list of grocery items or test functionality using an existing list
  5. Click the delete button. A prompt confirming your choice will appear
  6. If you confirm your desire to delete your item will be removed from the list
  7. Confirm the deletion in the database by checking firestore.

TODOS

github-actions[bot] commented 3 years ago

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

https://tcl-23-shopping-list--pr27-za-ar-delete-items-8g2p0cgw.web.app

(expires Wed, 19 May 2021 21:51:10 GMT)

🔥 via Firebase Hosting GitHub Action 🌎