Skip to content

C24-Jesica & Xi #8

Open
xiwu5 wants to merge 23 commits into
Ada-C24:mainfrom
jguall421:main
Open

C24-Jesica & Xi #8
xiwu5 wants to merge 23 commits into
Ada-C24:mainfrom
jguall421:main

Conversation

@xiwu5

@xiwu5 xiwu5 commented Dec 5, 2025

Copy link
Copy Markdown

No description provided.

Copilot AI review requested due to automatic review settings December 5, 2025 22:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This pull request implements a weather report application with real-time temperature fetching and interactive UI components. The implementation appears to be a student project (C24-Jesica & Xi) that creates a weather-themed application with temperature controls, sky conditions, and city selection.

Key Changes:

  • Implementation of weather report application with temperature display and controls
  • Integration with weather API using Axios for real-time data
  • Interactive UI with city name selection, sky conditions, and visual weather garden

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
package.json Added axios and dotenv dependencies with version issues
package-lock.json Generated lockfile for new dependencies with incorrect versions
index.html Added complete HTML structure for weather application UI
styles/index.css Added comprehensive CSS styling for weather components
src/index.js Implemented JavaScript functionality with minor naming issue
coworking_agreement.md Completed team agreement with spelling errors and future dates

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread coworking_agreement.md
## Accessibility Needs
*What does each team member need access to in order to succeed and show up the best they can?*

Jesica: Clear commuincation and transperancy of where each team memeber is at via Slack or meeting up outside of classroom hours. Attend Office hours for extra help when stuck in a wave.

Copilot AI Dec 5, 2025

Copy link

Choose a reason for hiding this comment

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

Spelling error: "transperancy" should be "transparency".

Suggested change
Jesica: Clear commuincation and transperancy of where each team memeber is at via Slack or meeting up outside of classroom hours. Attend Office hours for extra help when stuck in a wave.
Jesica: Clear commuincation and transparency of where each team memeber is at via Slack or meeting up outside of classroom hours. Attend Office hours for extra help when stuck in a wave.

Copilot uses AI. Check for mistakes.
Comment thread coworking_agreement.md
## Accessibility Needs
*What does each team member need access to in order to succeed and show up the best they can?*

Jesica: Clear commuincation and transperancy of where each team memeber is at via Slack or meeting up outside of classroom hours. Attend Office hours for extra help when stuck in a wave.

Copilot AI Dec 5, 2025

Copy link

Choose a reason for hiding this comment

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

Spelling error: "memeber" should be "member".

Suggested change
Jesica: Clear commuincation and transperancy of where each team memeber is at via Slack or meeting up outside of classroom hours. Attend Office hours for extra help when stuck in a wave.
Jesica: Clear commuincation and transperancy of where each team member is at via Slack or meeting up outside of classroom hours. Attend Office hours for extra help when stuck in a wave.

Copilot uses AI. Check for mistakes.
Comment thread coworking_agreement.md
## Collaboration vs. Individual Work Expectations
*Clarify your collaboration expectations - does your group want to write code together all of the time? Or divide work to do independently, then come together to share accomplishments? What tools and technologies can help your collaboration?*

Coding together for the first 2 waves so we can both be on the same page. Once we have a throught plan we can split the work up wether thats splitting 1 wave or all the waves together.

Copilot AI Dec 5, 2025

Copy link

Choose a reason for hiding this comment

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

Spelling error: "throught" should be "thought".

Copilot uses AI. Check for mistakes.
Comment thread coworking_agreement.md
## Collaboration vs. Individual Work Expectations
*Clarify your collaboration expectations - does your group want to write code together all of the time? Or divide work to do independently, then come together to share accomplishments? What tools and technologies can help your collaboration?*

Coding together for the first 2 waves so we can both be on the same page. Once we have a throught plan we can split the work up wether thats splitting 1 wave or all the waves together.

Copilot AI Dec 5, 2025

Copy link

Choose a reason for hiding this comment

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

Spelling error: "wether thats" should be "whether that's".

Copilot uses AI. Check for mistakes.
Comment thread coworking_agreement.md
## Accessibility Needs
*What does each team member need access to in order to succeed and show up the best they can?*

Jesica: Clear commuincation and transperancy of where each team memeber is at via Slack or meeting up outside of classroom hours. Attend Office hours for extra help when stuck in a wave.

Copilot AI Dec 5, 2025

Copy link

Choose a reason for hiding this comment

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

Spelling error: "commuincation" should be "communication".

Copilot uses AI. Check for mistakes.
Comment thread coworking_agreement.md

## One Team Communication Skill to Improve
*What is a teamwork-related skill you want to work on?*
Jesica: I would like to work on explaining code better to make sure my partner understand where I cam coming from or how did i get to the solution.

Copilot AI Dec 5, 2025

Copy link

Choose a reason for hiding this comment

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

Spelling error: "cam" should be "am".

Copilot uses AI. Check for mistakes.
Comment thread src/index.js Outdated
skyElement.textContent = getSkyDisplay(option);
};

const skySelectDropDwon = () => {

Copilot AI Dec 5, 2025

Copy link

Choose a reason for hiding this comment

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

Function name typo: "skySelectDropDwon" should be "skySelectDropDown" (missing "o" and incorrect capitalization).

Copilot uses AI. Check for mistakes.
Comment thread src/index.js Outdated
}

updateSkyDisplay(skySelectElement.value);
}

Copilot AI Dec 5, 2025

Copy link

Choose a reason for hiding this comment

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

Avoid automated semicolon insertion (97% of all statements in the enclosing script have an explicit semicolon).

Copilot uses AI. Check for mistakes.
Comment thread src/index.js
@@ -0,0 +1,242 @@
'use 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.

👍 Nice job remembering to add 'use strict'

Comment thread src/index.js
@@ -0,0 +1,242 @@
'use strict';

const BASE_URL = 'https://ada-weather-report-proxy-server.onrender.com';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👌 Good work using a constant value to refer to the proxy-server URL.

Comment thread src/index.js
Comment on lines +11 to +21
let tempElement = null;
let landscapeElement = null;
let skyElement = null;
let headerCityElement = null;
let cityNameInputElement = null;
let cityNameResetElement = null;
let increaseTempControlElement = null;
let decreaseTempControlElement = null;
let currentTempButtonElement = null;
let skySelectElement = null;
let gardenContent = null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Would prefer that these variables that reference elements are stored in the state object instead of having a bunch of global variables that are declared using let that could be accidentally changed (which could introduce bugs).

You can see an example of how we did this in pick-me-up-pup here.

Comment thread src/index.js
Comment on lines +23 to +30
const getElementBySelector = (selector) => {
const element = document.querySelector(selector);
if (element) {
return element;
} else {
return null;
}
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This helper function is unnecessary because it duplicates behavior that querySelector already has. Prefer to directly use querySelector without this helper.

Per the MDN docs "The Document method querySelector() returns the first Element within the document that matches the specified CSS selector, or group of CSS selectors. If no matches are found, null is returned."

Comment thread src/index.js
Comment on lines +48 to +56
const addCounter = () => {
state.counter += 1;
displayCurrentTemp();
};

const subtractCounter = () => {
state.counter -= 1;
displayCurrentTemp();
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The difference between these addCounter and subtractCounter are + and -. Can you think of a way to write this logic with just one function that increase or decrease the temperature without repeating logic.

Comment thread src/index.js
return '🌲🌲⛄️🌲⛄️🍂🌲🍁🌲🌲⛄️🍂🌲';
};

const changeCurrentTempColor = (temp) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This name could be a little more descriptive. When I read changeCurrentTempColor I make the assumption that this function changes the color of the temperature display (like 91 would be red). This function does 2 things though because it also updates the landscape.

A name like changeCurrentTempColorAndLandscape would be more descriptive.

Comment thread src/index.js
setTemperatureAndDisplay(temp);
} catch (err) {
console.error('Failed to fetch temperature:', err);
setTemperatureAndDisplay(DEFAULT_TEMPERATURE);

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 coming up with a default fallback plan for scenario where the call to get the current temp fails.

Comment thread src/index.js
Comment on lines +156 to +168
if (option == 'Sunny') {
skyElement.textContent = '☁️ ☁️ ☁️ ☀️ ☁️ ☁️';
gardenContent.style.backgroundColor = 'rgb(221, 255, 255)';
} else if (option == 'Cloudy') {
skyElement.textContent = '☁️☁️ ☁️ ☁️☁️ ☁️ 🌤 ☁️ ☁️☁️';
gardenContent.style.backgroundColor = 'lightgrey';
} else if (option == 'Rainy') {
skyElement.textContent = '🌧🌈⛈🌧🌧💧⛈🌧🌦🌧💧🌧🌧';
gardenContent.style.backgroundColor = 'lightblue';
} else if (option == 'Snowy') {
skyElement.textContent = '🌨❄️🌨🌨❄️❄️🌨❄️🌨❄️❄️🌨🌨';
gardenContent.style.backgroundColor = 'lightsteelblue';
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What if the adjectives that describe the weather like "Sunny", "Rainy", etc were keys in an object and the color and sky content were values?

If you had an object that held this data then you could refactor this implementation so you wouldn't need to chain many if-statements (which is brittle and difficult to maintain).

You could use option to get the corresponding sky and garden values:

let option = skySelectElement.value;

const sky_data = {
  "Rainy": ['☁️ ☁️ ☁️ ☀️ ☁️ ☁️', 'rgb(221, 255, 255)'],
  // rest of your data 
};

skyElement.textContent = sky_data[option][0];
gardenContent.style.backgroundColor = sky_data[option][1];

Comment thread src/index.js
displayCurrentTemp();
};

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.

Nice job organizing your code! I like that you have a function that 'loads' all the elements, like you do in initializeElements and I like that you have a function that registers all the event handlers.

The function registerEventHandlers does more than just registering event handlers though because it also performs some initial logic that needs to happen when the page loads (initializeElements and displayCurrentTemp).

I'd prefer this initial set up logic to be in a separate helper function, maybe something like setUpUI. And also introduce a function like onLoaded that would call setUpUI and registerEventHandlers. You can see an example of how we do this here in pick-me-up-pup.

const setUpUI = () => {
  // steps to carry out when the page has loaded
  initializeElements();
  displayCurrentTemp();
};

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

document.addEventListener('DOMContentLoaded', onLoaded);

Comment thread src/index.js
Comment on lines +225 to +233
if (cityNameInputElement) {
const initialCityName = getCityInputValue();
// Set initial city name header
updateCityNameHeader(initialCityName);
cityNameInputElement.addEventListener('input', () => {
const cityName = getCityInputValue();
updateCityNameHeader(cityName);
});
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'd prefer this logic to be in a function so that you can pass a named function to addEventListener on line 229 (instead of passing an anonymous function like you currently do).

Having named functions that you can pass to addEventListener makes your code easier to understand and maintain.

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.

4 participants