Skip to content

Weather App_eval3#218

Open
jlneuser wants to merge 6 commits intoprojectshft:masterfrom
jlneuser:master
Open

Weather App_eval3#218
jlneuser wants to merge 6 commits intoprojectshft:masterfrom
jlneuser:master

Conversation

@jlneuser
Copy link

No description provided.

@@ -0,0 +1,68 @@
h1 {

Choose a reason for hiding this comment

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

many styles here and layouts could have been bootstrap classes
i.e. card, card-body, rounded, or shadow-sm

forecastDiv.style.display = 'none';

searchButton.addEventListener('click', () => {
const city = cityInput.value;

Choose a reason for hiding this comment

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

here the input needs to be trimmed

Copy link
Author

Choose a reason for hiding this comment

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

ahh, yes. Thanks for this catch!

});
}

function fetchForecast(city) {

Choose a reason for hiding this comment

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

this function is too big. Need to be extracted into smaller chunks to help with readability and maintainability

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, Rony. How would this look as an example?

Choose a reason for hiding this comment

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

the function is getting data and adding it to the dom, you can create a get data function that returns a promise of that data and then split the for loop logic as well.
The best you can do is ask yourself, is this function only fetching the forecast? not only, is fetching and... rendering, and arranging the data and displaying, etc... all these can be functions. I suggest you review this deeper with your mentor

currentWeatherDiv.style.display = 'block';
})
.catch((error) => {
console.error('Error, didn\'t fetch weather', error);

Choose a reason for hiding this comment

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

this gives no feedback to the user

Copy link
Author

Choose a reason for hiding this comment

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

What would be the corrected code to give feedback to the user?

Choose a reason for hiding this comment

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

ideally would be an actual message that is rendered in the UI but for now alert could work as well

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.

2 participants