Closed lydiadunning closed 1 year ago
Visit the preview URL for this PR (updated for commit 46e5645):
https://tcl-65-smart-shopping-list--pr21-ld-is-join-and-share-g8ybfaf7.web.app
(expires Sun, 10 Sep 2023 16:41:02 GMT)
🔥 via Firebase Hosting GitHub Action 🌎
Sign: a91b8fb0f37677e20d8afa3e8ea496251536f9b8
Description
This PR adds functionality allowing the user to connect to an existing list.
User Facing Behavior
Adds a text input field to a form in the Home view, allowing a user to input a listToken. When this form is submitted, if the list exists the listToken is saved in local storage and the user is redirected to the list page. Otherwise, a message informs the user that the list was not found.
Firebase API
Adds a function to firebase.js to return the count of items in a collection. If the collection does not exist, the count will be 0.
Refactoring
Changed the AddItem view so that when a new item is added to a new list, firebase creates a new collection with the same name as the token in local storage.
Related Issue
closes #5
Acceptance Criteria
If a user doesn’t already have a token:
Home
view shows a form that allows the user to enter a token to join an existing list, in addition to the button that allows them to create a new list.label
element associated with itsEnter
keylocalStorage
List
view and shown the items on that listIf a user does already have a token:
List
view.Type of Changes
Updates
Before
After
https://github.com/the-collab-lab/tcl-65-smart-shopping-list/assets/71429289/e0c7ae2c-d540-4c88-97c1-db332bc71ef8
Testing Steps / QA Criteria