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

Yonese J. - Sharks #63

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Yonese J. - Sharks #63

wants to merge 1 commit into from

Conversation

yonesejames
Copy link

No description provided.

Copy link

@yangashley yangashley left a comment

Choose a reason for hiding this comment

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

Nice work on this project!

You made good use of DOM features to handle button clicks related to the temperature changing colors. Your sky selection and landscape features work great!

Let me know if you have any questions about the comments.

🟢 for weather-report!

Comment on lines +20 to +21
<h1 id="navHeaderOne">Welcome to Weather Report!</h1>
<span id="navHeaderThree">Currently displaying temperature for <span id="cityName">Orlando</span></span>

Choose a reason for hiding this comment

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

For the scope of a small page like this, having id being called navHeaderOne or navHeaderThree is ok, but it's helpful to have id or class names that is a little more descriptive. In the future when you're working with pages with many elements, your id should clue you in to what element it's on so when you're checking out your css or js that uses navHeaderOne you might not need to go back to the HTML to see what element it's refering to.

For example, navHeaderOne could be something like weatherWelcomeMessage



<script src="src/index.js"></script>
<script src="./node_modules/axios/dist/axios.min.js"></script>

Choose a reason for hiding this comment

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

Nicely written, semantic HTML!

Comment on lines +30 to +45
if(state.temp <= 49){
state.tempColor = "teal";
temp.style.color = state.tempColor;
} else if(50 <= state.temp && state.temp <= 59){
state.tempColor = "green"
temp.style.color = state.tempColor;
} else if(60 <= state.temp && state.temp <= 69){
state.tempColor = "yellow";
temp.style.color = state.tempColor;
} else if(70 <= state.temp && state.temp <= 79){
state.tempColor = "orange";
temp.style.color = state.tempColor;
} else if(state.temp >= 80){
state.tempColor = "red";
temp.style.color = state.tempColor;
}

Choose a reason for hiding this comment

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

In this method you set state.tempColor but then it's not being accessed anywhere else (other than on first page load on line 14.

You could directly set the color on temp.style.color like:

if(state.temp <= 49){
    temp.style.color ="teal";
}


const state = {
temp : 80,
tempColor: "red",

Choose a reason for hiding this comment

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

I see that you add tempColor to state in order to access the value on line 14 to initialize your page so that the 80 degrees shows up in red.

After this though, you don't use tempColor (I dropped a comment tempColor about setting state.color).

Since you don't need to persist tempColor, you could leave it out of the state object


const temp = document.getElementById("tempValue");
temp.textContent = state.temp + "°";
temp.style.color = state.tempColor;

Choose a reason for hiding this comment

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

If you remove tempColor from `state, then you can just hardCode red here

temp.style.color = "red";

Comment on lines +170 to +171
// const getRealTempBtn = document.getElementById("realTempBtn");
// getRealTempBtn.addEventListener("click", getRealTemp);

Choose a reason for hiding this comment

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

Remember to remove unused, commented out code so that it doesn't accidentally get uncommented and incorrectly executes.

Comment on lines +91 to +94
const getRealTemp = () => {
state.changeCity = document.getElementById("city").value;
getLatLon();
}

Choose a reason for hiding this comment

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

Is this method being used? I don't think it is. It's referenced in a comment but never executes so you can remove it altogether

};

const getWeather = () => {
axios.get("http://127.0.01:5000/weather", {

Choose a reason for hiding this comment

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

You can store this string literal into a variable WEATHER_URL

};

const getLatLon = () => {
axios.get("http://127.0.01:5000/location", {

Choose a reason for hiding this comment

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

You can store this url into a constant LOCATION_URL

Comment on lines +77 to +89
const input = document.querySelector("input");
const city = document.getElementById("cityName");
input.addEventListener("input", () => {
state.changeCity = document.getElementById("city").value;
document.getElementById("cityName").innerHTML = state.changeCity;
});

const reset = document.getElementById("resetBtn");
const resetValue = input.getAttribute("placeholder");
reset.addEventListener("click", () => {
input.value = resetValue;
city.textContent = resetValue;
})

Choose a reason for hiding this comment

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

It would make more sense for these statements to be put in registerEventHandlers() instead of sitting out here out in the open.

I see that lines 77-89 execute when the page first renders so it makes sense to have them in registerEventHandlers with all the others

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