Skip to content

Yael Peet Weather Report - #52

Open
yaelsilvermanpeet wants to merge 17 commits into
Ada-C19:mainfrom
yaelsilvermanpeet:main
Open

Yael Peet Weather Report#52
yaelsilvermanpeet wants to merge 17 commits into
Ada-C19:mainfrom
yaelsilvermanpeet:main

Conversation

@yaelsilvermanpeet

Copy link
Copy Markdown

No description provided.

Comment thread index.html
<header class="header__header">
<h1>Weather Report</h1>
<span>For the lovely city of
<span id="headerCityName" class="header__city-name"></span></span>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We might want to hard code a default city in the HTML if we want a city to exist that we can get the real time temp for when the page first loads up.

Comment thread src/index.js
Comment on lines +143 to +145



Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Small nitpitck: we should review our code to ensure we're consistently applying spacing between functions across the project to avoid confusion from readers/maintainers around if functions are grouped for a reason or if something was added or removed and the spacing wasn't updated.

Comment thread src/index.js
if (state.tempInt < 0 || state.tempInt > 120) {
state.tempValue.style.color = 'red';
state.tempValue.textContent = 'DANGER'
landscape = '🚫🚫🚫TOO MUCH WEATHER🚫🚫🚫';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💯 agreed

Comment thread src/index.js
Comment on lines +161 to +162
const registerEventHandlers = () => {
loadControls();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

By adding the call to loadControls inside registerEventHandlers, the function is doing more than one thing. Thinking about testing, we'd have to do a bit more set up to test this function since it needs to confirm that both loading and registering happened successfully. I would consider reorganizing this to have a separate function named something like setUpPage that first calls loadControls then calls registerEventHandlers.

Our situation here is small enough that we may not see the benefit, but consider a larger project where maybe we could pass functions to use into the registerEventHandlers function. We'd want to be able to call that independently with different parameters without needing to reload controls that we already have references to.

Comment thread src/index.js
Comment on lines +151 to +159
const handleCurrentTempButtonClicked = () => {
findLatAndLon()
.then((location) => getWeather(location))
.then((targetTemp) => {
console.log(targetTemp)
state.tempInt = targetTemp;
applyColorAndGarden();
})
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great use of helpers and chaining promises! ✨

Comment thread src/index.js


};
document.addEventListener("DOMContentLoaded", registerEventHandlers);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Really nice use of functions to organize the code overall ^_^

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