-
Notifications
You must be signed in to change notification settings - Fork 575
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
Weather app - Jenny A #431
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job with this project.
Good use of comments the explain your code
Good use of functions, really impressed by the way you are splitting up the code in understandable and perfect sized functions. Good naming as well.
I made some comments in the lines of code too regarding adding code that you might have gotten from a mentor, friend, other code, AI etc.
I suggest that you set up your indentations for you projects to 2 spaces, it makes it easier to read (html file specifically.
You don't need to change anything to get approved! These are just suggestions going forward.
Keep up the good work 💪
const processForecastData = (list) => { | ||
const today = new Date().getDate(); | ||
|
||
return list | ||
// Transform each item into an object with the data we need | ||
.map(item => ({ | ||
date: new Date(item.dt * 1000), | ||
icon: item.weather[0].icon, | ||
temp: Math.round(item.main.temp) | ||
})) | ||
// Filter out today's weather and nighttime forecasts | ||
.filter(item => { | ||
const hour = item.date.getHours(); | ||
return item.date.getDate() !== today && hour >= 6 && hour <= 18; | ||
}) | ||
// Reduce to max 5 items, one per day | ||
.reduce((acc, item) => { | ||
if (acc.length < 5 && (acc.length === 0 || item.date.getDate() !== acc[acc.length - 1].date.getDate())) { | ||
acc.push(item); | ||
} | ||
return acc; | ||
}, []); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good way to use these methods. It is a bit advanced to do all this in one go like you are doing. I believe youi might have gotten help with structuring this code, which is totally fine. However it is superimportant that you really understand the code. So good that you have added comments to it, but also try to find the opportunity to actually explain this code to someone. Either in your team, in a short screen recording to the class, to a friend or family member (even though they might not understand coding) This will help you befästa kunskapen and also prepare you for upcoming technical interviews and demos "in real world"
@@ -115,3 +115,4 @@ Explore the API and use another endpoint of the Weather API to include supplemen | |||
|
|||
**Feature: CSS Animations** | |||
Add some CSS animations to your app, e.g. pulsating sun/raindrops. | |||
okoi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
? 😉
https://whats-the-weather-jenny.netlify.app/