Skip to content

Sapphire- Edith & Janice#49

Open
janice15 wants to merge 37 commits intoAda-C19:mainfrom
janice15:main
Open

Sapphire- Edith & Janice#49
janice15 wants to merge 37 commits intoAda-C19:mainfrom
janice15:main

Conversation

@janice15
Copy link

No description provided.

Copy link

@mmcknett-ada mmcknett-ada left a comment

Choose a reason for hiding this comment

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

Hey Edi & Janice, great job! 🟢

You were really close to having everything working perfectly, there were just a few minor issues:

  • Needed to change updateSky --> resetSky
  • Needed to pass the correct querystring params to the /weather endpoint

The only things to watch out for besides that are code indent/spacing style, naming, and use of semantic HTML.

I really like how you styled your page with CSS. Well done!

axios.get('http://127.0.0.1:5500/weather',
{
params: {
q: state.city,

Choose a reason for hiding this comment

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

This was expecting you to pass lat and lon parameters. This causes you to get a response that says {"message":"must provide lat and lon parameters"} and makes your .catch run because weather ends up being undefined on line 23.

Choose a reason for hiding this comment

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

Suggested change
q: state.city,
lat: state.lat,
lon: state.long

color: yellow
}
.yellow-green {
color:yellowgreen

Choose a reason for hiding this comment

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

[nit] try to consistently space

Suggested change
color:yellowgreen
color: yellowgreen


<section id="city">
<h2>City Name</h2>
<input type="text" id="textInput" value="Seattle">

Choose a reason for hiding this comment

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

[nit] cityInput might be better for id since its more descriptive.

</div>
</section>

<section id="sky" onclick="resetSky()">

Choose a reason for hiding this comment

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

It's a little confusing if some elements have an onclick defined and some elements have their click handlers registered for in the .js file (in registerEventHandlers). It's probably better to pick one or the other.

<body>
<script src="./src/index.js"></script>

<section>

Choose a reason for hiding this comment

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

[nit] Try to indent consistently. This whole <section> should be tabbed one to the right.

font-size: 2em;
}

#text_weather {

Choose a reason for hiding this comment

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

[nit] I'm used to seeing - to separate words, e.g. text-weather

Comment on lines +18 to +20
<span id="for_city"> <h3>For the city of</h3>
<div id="output">Seattle</div>
</span>

Choose a reason for hiding this comment

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

It's a little strange to have two block-level elements inside a line-level element. Probably better to use div instead of span here and on text_weather. Also, h3 seems like it's not being used semantically, since there's no intervening h2. You might prefer to just define a class with the styling you want and apply that in a span or div.

Comment on lines +15 to +23
<header>
<span id="text_weather">
<h1 > Weather Report</h1>
<span id="for_city"> <h3>For the city of</h3>
<div id="output">Seattle</div>
</span>

</span>
</header>

Choose a reason for hiding this comment

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

Indentation & spacing nits

Suggested change
<header>
<span id="text_weather">
<h1 > Weather Report</h1>
<span id="for_city"> <h3>For the city of</h3>
<div id="output">Seattle</div>
</span>
</span>
</header>
<header>
<span id="text_weather">
<h1> Weather Report</h1>
<span id="for_city">
<h3>For the city of</h3>
<div id="output">Seattle</div>
</span>
</span>
</header>

};

const findLatitudeAndLongitude = () => {
let lat, long;

Choose a reason for hiding this comment

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

You can remove these since you're using state.lat and state.long


resetSky();
const skySelect = document.getElementById('skySelect');
skySelect.addEventListener('change', updateSky);

Choose a reason for hiding this comment

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

There's no updateSky, and you have resetSky hooked up to the click handler of the sky select box. That's why your sky doesn't update after you select the type of sky, but it does update after you click the selector for a second time.

Choose a reason for hiding this comment

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

Just hooking up resetSky seems to fix this.

Suggested change
skySelect.addEventListener('change', updateSky);
skySelect.addEventListener('change', resetSky);

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