Skip to content

PR#32

Open
sofia-grunditz wants to merge 11 commits intoTechnigo:mainfrom
sofia-grunditz:main
Open

PR#32
sofia-grunditz wants to merge 11 commits intoTechnigo:mainfrom
sofia-grunditz:main

Conversation

@sofia-grunditz
Copy link
Copy Markdown

Please review my project :)

@sofia-grunditz
Copy link
Copy Markdown
Author

Forgot to add Netlify-link: https://recipeproject-sofia.netlify.app/

Copy link
Copy Markdown
Contributor

@HIPPIEKICK HIPPIEKICK left a comment

Choose a reason for hiding this comment

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

Nice and descriptive function names, continue with this! Remember to always stick to const as much as you can. Basically you only need to use let if you bump into issues. Also, you have some repetitive code that could be cleaned up (e.g. the duplicate URL) as well as some console.logs that should not be kept in production code.

Some other styling ideas:

  • There’s no special styling on the chosen diet filter, just on the chosen cuisine. Is this deliberate?
  • You’ve chosen to put the instructions directly in the card (instead of just showing them on a button click or something), which isn’t wrong or anything, but since some instructions are very long it makes the card grid look a bit off. Consider showing only part of the instructions and then showing the rest on a button click or hover (i.e. Show more… button).

Changes requested

  • Can’t see you’ve met this requirement: “Your page should show a useful message to the user in case the daily API quota has been reached”
  • Your page is not fully responsive. Please have a look at how your app looks in mobile (320px width). It’s a bit too crowded 👀
  • The user should be able to click a button that selects a random recipe, and your page should display the selected item
  • Your page should have an empty state, e.g. if there are no recipes matching the filter - show a meaningful message to the user

…added a message section that displays errors/when the api quota is reached, improved the random recipe button
@sofia-grunditz
Copy link
Copy Markdown
Author

Hey @HIPPIEKICK ! Thank you for your feedback. I've tried to make the requested changes, please have a look and see what you think :)

Copy link
Copy Markdown
Contributor

@HIPPIEKICK HIPPIEKICK left a comment

Choose a reason for hiding this comment

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

Great improvements ⭐

Copy link
Copy Markdown
Contributor

@HIPPIEKICK HIPPIEKICK left a comment

Choose a reason for hiding this comment

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

Sorry, clicked the wrong button 😅 You're approved!

@sofia-grunditz
Copy link
Copy Markdown
Author

Thank you so much @HIPPIEKICK !

Copy link
Copy Markdown

@mimmi-eriksson mimmi-eriksson left a comment

Choose a reason for hiding this comment

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

Overall, the site looks and works great! Nice work with the styling and the filters, sorting and random functions all works as they should. Your code is really clear and structured which makes it very easy to read! I just added some minor comments and suggestions.

Keep up the good work Sofia!

Comment thread index.html
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Clear and nicely structured html!

Comment thread index.html

<section
id="messages"
style="display: none;"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This line could be removed since you have it in the css :)

Comment thread script.js
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice and clear, easy to read code! Naming of variables and functions are very descriptive👍

Comment thread script.js
Comment on lines +23 to +25
let currentPage = 1; // Håller reda på vilken sida vi är på
const recipesPerPage = 20; // Hur många recept vi vill hämta per gång
let scrollEnabled = true; // Håller reda på om scroll är aktiverad
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You might want to change the comments to english

Comment thread script.js
Comment on lines +23 to +25
let currentPage = 1; // Håller reda på vilken sida vi är på
const recipesPerPage = 20; // Hur många recept vi vill hämta per gång
let scrollEnabled = true; // Håller reda på om scroll är aktiverad
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I like that you implemented a feature that fetches more recipes if you scroll down!
However, there seems to be a small bug here when I have selected a filter and scrolls down to the bottom of the page, it will fetch new recipes and show all. I see that for the random button you turn off the scroll function when the button is clicked and turn it back on after a delay. Maybe you could do something similar for the filter buttons? Another solution would be to only use the scrollEnable variable and update the value when you want the scroll to be active (scrollEnable=true), eg when site is loaded and when the "all button" is selected. And then inactivate scroll (scrollEnable=false) when filters, sorting and random are active.

Comment thread script.js
Comment on lines +192 to +205
// Event listener for scroll
window.addEventListener('scroll', () => {
// checking if the user is near the end of the page
if (scrollEnabled && window.innerHeight + window.scrollY >= document.body.offsetHeight - 100) {
// loading more recipes
if (recipes.length >= currentPage * recipesPerPage) {
currentPage++;
fetchRecipes();
}
setTimeout(() => {
scrollEnabled = true; // Re-enable scroll after a delay
}, SCROLL_DELAY);
}
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Again, I really like this feature :) Good explanations in the code

Comment thread style.css
color: white;
border: 2px solid #4a43460f;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Maybe you could add an "active" class on the diet filter buttons too (like you have for the cuisine filter and sorting) to make it more clear which filter is selected

Comment thread style.css
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
max-width: 288px;
width: 100%;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I noticed a small style issue on larger screens: for some widths (ca 928-1125px and ca 1248-1512px), the cards seems to span over the vertical gaps i the grid. I think this can be fixed by removing this width 100% on the cards. I tried to remove it and I think it still looks good on smaller screens :)

Comment thread style.css
.filters {
flex-direction: row;
justify-content: flex-start;
align-items: center;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This line can be removed, you already have align-items:center in the mobile default style (on line 29)

Comment thread style.css
}

.card {
max-width: 288px;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can also be removed, same max-width as in the mobile style

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.

3 participants