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

Looped data into List.jsx and into Home.jsx #19

Merged
merged 3 commits into from
Aug 18, 2024

Conversation

EmmaBin
Copy link
Collaborator

@EmmaBin EmmaBin commented Aug 14, 2024

For an example of how to fill this template out, see this Pull Request.

Description

Sarah and I worked on task #2. We updated Home.jsx and List.jsx to loop over the data and render the names of each shopping list a user is subscribed to, as well as the names of each item. One thing to note is that we haven’t inserted the path prop in Home.jsx, as we need further information to create the path. Since we don’t have a database created yet, we attempted to navigate to the /list page, except for one error from firebase.js, there are no errors caused by our implementation.

Related Issue

  1. As a user, I want to read all of my shopping lists and the items in them.

Acceptance Criteria

  • In Home.jsx, the SingleList component is used to render the name of each shopping list a user is subscribed to
  • In List.jsx, the ListItem component is used to render the name of each item

Type of Changes

feature

Updates

Before

DE3275B8-A3A8-41B6-A8F4-DABAA1AAE45B
1B739864-755E-483D-8FE9-5DAAAB9053B3

After

Screenshot 2024-08-13 at 7 58 54 PM
Screenshot 2024-08-13 at 7 58 37 PM

Testing Steps / QA Criteria

@EmmaBin EmmaBin requested review from fullybaked and arandel1 August 14, 2024 04:01
Copy link

github-actions bot commented Aug 14, 2024

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

https://tcl-76-smart-shopping-list--pr19-sm-eb-read-shopping-11v5vu6k.web.app

(expires Sun, 25 Aug 2024 16:23:54 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 512b1a88be8ae05fd3e727b99332819df760271d

Copy link
Collaborator

@MarcosPerez16 MarcosPerez16 left a comment

Choose a reason for hiding this comment

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

Awesome!

Copy link
Collaborator

@arandel1 arandel1 left a comment

Choose a reason for hiding this comment

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

Looks good!

@mentalcaries mentalcaries removed the request for review from fullybaked August 17, 2024 11:02
* so we can see which lists the user has access to.
*/}
{/* insert path as prop later */}
{data &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good job with including a null check here!

@@ -7,6 +7,10 @@ export function List({ data }) {
Hello from the <code>/list</code> page!
</p>
<ul>
{data &&
data.map((list) => {
return <ListItem key={list.id} name={list.name} />;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like that you all passed the key prop here to the list item!

Copy link
Collaborator

@mentalcaries mentalcaries left a comment

Choose a reason for hiding this comment

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

A simple issue, but very well done!

Comment on lines 15 to 17
key={list.id}
name={list.name}
setListPath={setListPath}
Copy link
Member

Choose a reason for hiding this comment

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

Now that we have the right data structure in Firebase, go ahead and add the path here! This should work with that change! 👍

Copy link
Collaborator

Choose a reason for hiding this comment

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

Added it! Also, there was an error that the keys weren't unique so used the randomUUID() method to pass into the keys for now.

key={crypto.randomUUID()}
name={list.name}
setListPath={setListPath}
path={path}
Copy link
Member

Choose a reason for hiding this comment

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

This path actually comes from the list item itself!

Suggested change
path={path}
path={list.path}


export function Home({ data, setListPath }) {
import { SingleList } from '../components';
export function Home({ data, setListPath, path }) {
Copy link
Member

Choose a reason for hiding this comment

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

See other comment - the path comes from the list itself.

Suggested change
export function Home({ data, setListPath, path }) {
export function Home({ data, setListPath }) {

@EmmaBin EmmaBin merged commit 5b7c9c3 into main Aug 18, 2024
2 checks passed
@mentalcaries mentalcaries deleted the sm-eb-read-shopping-list-and-items branch August 30, 2024 00:08
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.

6 participants