Skip to content

Ellie & Laura Ada C23#20

Open
lavendercaterpillar wants to merge 36 commits intoAda-C23:mainfrom
lavendercaterpillar:main
Open

Ellie & Laura Ada C23#20
lavendercaterpillar wants to merge 36 commits intoAda-C23:mainfrom
lavendercaterpillar:main

Conversation

@lavendercaterpillar
Copy link
Copy Markdown

No description provided.

lauracastrotech and others added 30 commits June 2, 2025 13:46
adds event listeners to increase and decrease button
Copy link
Copy Markdown

@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 job on weather-report, team!

Comment thread PAIR_PLAN.md
Comment on lines +54 to +57
## Signatures
Laura Castro______________ Ellie A_______________
Date: June 2, 2025_________

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍🤗

Comment thread src/index.js
@@ -0,0 +1,230 @@
"user strict"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
"user strict"
"use strict"

Comment thread src/index.js
Comment on lines +2 to +3
const locationURL = 'http://127.0.0.1:5000/location'
const weatherURL = 'http://127.0.0.1:5000/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.

Nice job using constant variables to reference the endpoints.

Suggested change
const locationURL = 'http://127.0.0.1:5000/location'
const weatherURL = 'http://127.0.0.1:5000/weather'
const LOCATION_URL = 'http://127.0.0.1:5000/location'
const WEATHER_URL = 'http://127.0.0.1:5000/weather'

Comment thread src/index.js
Comment on lines +46 to +47
console.log('renderTemp temp= ', temp)
console.log('currentTemp state= ', state.currentTemp)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remove debugging print statements after you're done using them to keep your project from getting bloated with code that isn't necessary to the implementation.

Suggested change
console.log('renderTemp temp= ', temp)
console.log('currentTemp state= ', state.currentTemp)

Comment thread src/index.js
Comment on lines +8 to +10
currentTemp: 70,
city: 'Seattle',
skySelect: 'cloudy'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

As a way to further organize your project, I'd prefer that the elements that you access to make updates to the page get declared here and set all at once during page load, like we did in this example: https://github.com/Ada-Activities/Pick-Me-Up-Pup/blob/c23-solution/src/index.js#L4-L10

Comment thread src/index.js
Comment on lines +135 to +140
// // console.log('in realtime set, before get real time', state.currentTemp)
// state.currentTemp = getRealTimeTemp();
// temp.textContent = state.currentTemp;
// // console.log('in realtime set after real time, state of current temp', state.currentTemp)
// renderTemp(temp);
// return
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
// // console.log('in realtime set, before get real time', state.currentTemp)
// state.currentTemp = getRealTimeTemp();
// temp.textContent = state.currentTemp;
// // console.log('in realtime set after real time, state of current temp', state.currentTemp)
// renderTemp(temp);
// return

All commented out code that is not necessary to the implementation should be cleaned up before a PR.

At work, opening a PR for review is asking for your code to be merged into main. A team will most likely not allow any extra lines of code to be merged into main because it bloats the code base and makes it unorganized and difficult to maintain.

It can also be confusing to read this and need to figure out, why was this left in? should i uncomment it?

It could get accidentally uncommented which could result in a bug.

Comment thread src/index.js
Comment on lines +156 to +164
// .then(response => {
// const { lat, lon } = response;
// return axios.get(weatherURL, {
// params: {
// lat: lat,
// lon: lon
// }
// })
// })
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
// .then(response => {
// const { lat, lon } = response;
// return axios.get(weatherURL, {
// params: {
// lat: lat,
// lon: lon
// }
// })
// })

Remove commented out code

Comment thread src/index.js
Comment on lines +81 to +83
// Get the references to DOM elements
const inputField = document.getElementById('inputCity');
const cityOutput = document.getElementById('city-output');
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It looks like these two functions are meant to run during page load because I don't see them encapsulated in a function. It's not immediately evident to me that there's code that should run on page load because it's kind of sprinkled throughout this js file.

For example, I see a stand alone function call on lines 180-181, line 207 that executes on page load.

I'd prefer a method onLoaded that executes everything required for setting the page up.

const onLoaded = () => {
  registerEventHandlers();
  loadControls();
};

document.addEventListener("DOMContentLoaded", onLoaded); 

Comment thread src/index.js

// defines small functions of event listener
const updateCityName = () => {
// cityOutput.textContent = inputFieldValue;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
// cityOutput.textContent = inputFieldValue;

Delete uneccessary code

Comment thread src/index.js
Comment on lines +183 to +195
const updateSkyDisplay = () => {
const sky = state.skySelect;

if (sky === 'sunny') {
skyDisplay.textContent = '☁️ ☁️ ☁️ ☀️ ☁️ ☁️';
} else if (sky === 'cloudy') {
skyDisplay.textContent = '☁️☁️ ☁️ ☁️☁️ ☁️ 🌤 ☁️ ☁️☁️';
} else if (sky === 'rainy') {
skyDisplay.textContent = '🌧🌈⛈🌧🌧💧⛈🌧🌦🌧💧🌧🌧';
} else if (sky === 'snowy') {
skyDisplay.textContent = '🌨❄️🌨🌨❄️❄️🌨❄️🌨❄️❄️🌨🌨';
};
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could loop through an object to set these values instead of having a lot of conditional logic here.

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