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

Rt el add new item #21

Merged
merged 8 commits into from
Aug 25, 2024
Merged

Rt el add new item #21

merged 8 commits into from
Aug 25, 2024

Conversation

GrannyYetta
Copy link
Collaborator

Type
New Feature
Save new item to the shopping list

Description

In the ManageList view we implemented a form where the user can sumbit a new item that will be saved into the current shopping list.

In firebase.js we implemented a firebase/firestore method addDoc to save a new item into the database, as instructed by the documentation.

Related Issue

Closes #5

Acceptance Criteria

UI-related tasks:

  • The ManageList view displays a form that allows them to enter the name of the item and select how soon they anticipate needing to buy it again. There should be 3 choices for this:
    • “Soon”, corresponding to 7 days
    • “Kind of soon”, corresponding to 14 days
    • “Not soon”, corresponding to 30 days
  • The input that accepts the name of the item has a semantic label element associated with it
  • The user can submit this form with both the mouse and the Enter key
  • When the user submits the form, they see a message indicating that the item either was or was not saved to the database.

Data-related tasks:

  • The console.log in the addItem function in src/api/firebase.js is replaced with a function that adds the new document to the Firestore database. That function will be imported from the firebase/firestore module.
  • The user’s soon/not soon/kind of soon choice is used to calculate nextPurchasedDate

Type of Changes

New feature in the ManageList view

Updates

Before

Screenshot 2024-08-23 at 17 36 16

After

Screenshot 2024-08-23 at 17 39 39

Screenshot 2024-08-23 at 17 40 01

Testing Steps / QA Criteria

Start app in the browser --> navigate to ManageList --> fill out the form --> submit

Submit the form without filing it out completely. An error message should appear.

Copy link

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

https://tcl-78-smart-shopping-list--pr21-rt-el-add-new-item-yw6hapaf.web.app

(expires Fri, 30 Aug 2024 15:50:13 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: c781903507c1507075d7a974036959ddeec29c0a

@eva-lng eva-lng requested review from didemydn and tataw-cl August 23, 2024 17:25
@tataw-cl
Copy link
Contributor

Hey guys, the form works ok, but when I try to create a new list, it returns an error message "Failed to add the item to the list". I consoled it and it seems the error comes from the function which adds the new list to the database. The "addItem" function seems to be taking an empty path which returns the error when trying to create a new list item. Check it out

Copy link
Contributor

@tataw-cl tataw-cl left a comment

Choose a reason for hiding this comment

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

Just make sure the "listPath" parameter to the "addItem" function takes an actual path. Aside from that, everything else looks ok

@didemydn
Copy link
Collaborator

I am successful in adding a new item and displaying the item on the list view. it is working fine as below.
thank you!

flower has been successfully added to the list

image

@GrannyYetta GrannyYetta merged commit 7424b50 into main Aug 25, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5. As a user, I want to add a new item to my shopping list so I can start recording purchases
4 participants