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

Jamie Horvath C-17 Digital Sharks #87

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

Conversation

glassofcat
Copy link

No description provided.

Copy link

@audreyandoy audreyandoy left a comment

Choose a reason for hiding this comment

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

Fantastic work Jamie! Your project met all the requirements. And I loved your algorithm to generate the hex color as the temp changes definitely made up for it.

I didn't have much feedback to add as your code is very neat. Design-wise, it wasn't obvious that users could click on the city text to switch to 'Reset Location'. A hover effect or a separate button that clearly says "reset city" would have been helpful.

Other than that great work!

Grade: 🟢

Comment on lines +41 to +69
lets do centered column flex elements
reset button0<(city name)
3 buttons stacked next to <(70 degrees)
update the background gradient per temperature

x An element that displays the temperature
x A clickable element to increase temperature
x A clickable element to decrease temperature
x An element that displays a landscape
x bottom gradient from blue to red

Wave 3:

x An element that displays the city name
x? An element that contains an <input type="text"> element, used to rename the city

Wave 4:

x A clickable element to get the current temperature of the displayed city name

Wave 5:
top gradient yellow sun, grey cloud, blue rain, white snow
? A <select> dropdown element to set the sky type
? An element that displays a sky

Wave 6:

x A clickable element to reset the city name -->

Choose a reason for hiding this comment

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

These are great notes, however, the intended use of PRs is to share code that we'd like our team to also have. I highly recommend putting these type of notes in a local branch as you're working through some code.

Comment on lines +12 to +32
const getTemp = () => {
axios
.get('http://localhost:5000/weather', {
params: {
lat: state.lat,
lon: state.lon,
},
})
.then((response) => {
state.temp = parseInt(
((response.data['current'].temp - 273) * 9) / 5 + 32
);
state.weather = response.data['current']['weather'][0].main;
console.log('success in finding weather!', state.temp, state.weather);
tempChange(state.temp, true);
})
.catch((error) => {
console.log('error in weather');
});
return state.temp;
};

Choose a reason for hiding this comment

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

👍

Comment on lines +4 to +10
const state = {
location: '',
temp: 70,
weather: '',
lat: 0,
lon: 0,
};

Choose a reason for hiding this comment

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

👍

Comment on lines +37 to +38
const toHex = (dec) => (dec < 16 ? '0' + dec.toString(16) : dec.toString(16));
const normalize = (newTemp) => (newTemp % 35) / 35;

Choose a reason for hiding this comment

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

LOVE this formula to generate the temp color!!!

} else {
color = ['FF', '00', '00'];
}
return ['#', ...color].join('');

Choose a reason for hiding this comment

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

Clever!

};
/////////////////////////////////////////////
const getLocation = () => {
print;

Choose a reason for hiding this comment

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

I don't think you need htis line.

Comment on lines +110 to +113
console.log('success in finding location!', state.lat, state.lon);
})
.catch((error) => {
console.log('error in location');

Choose a reason for hiding this comment

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

Good job in error handling and utilizing logs to confirm the behavior of your get request. However, unless we're making a terminal program, we should keep console.logs out of PRs.

Comment on lines +118 to +126
const locationChange = () => {
const currentLocation = document.querySelector('#location');
const locationButton = document.querySelector('#locationReset');

state.location = currentLocation.value;
getLocation();
locationButton.textContent = state.location;
currentLocation.value = '';
};

Choose a reason for hiding this comment

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

👍

Comment on lines +128 to +134
const clearLocation = () => {
const locationButton = document.querySelector('#locationReset');
locationButton.textContent = 'Reset Location';
state.location = '';
state.lat = 0;
state.lon = 0;
};

Choose a reason for hiding this comment

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

👍

Comment on lines +136 to +154
const registerEventHandlers = () => {
const upTempButton = document.querySelector('#up_temp');
upTempButton.addEventListener('click', (event) => tempChange(1, false));
const downTempButton = document.querySelector('#down_temp');
downTempButton.addEventListener('click', (event) => tempChange(-1, false));
const setTempButton = document.querySelector('#lookup_temp');
setTempButton.addEventListener('click', (event) => getTemp());

const updateLocation = document.querySelector('#location');
updateLocation.addEventListener('change', (event) => locationChange());
const updateWeather = document.querySelector('#weatherBox');
updateWeather.addEventListener('change', (event) => weatherChange());

const locationResetButton = document.querySelector('#locationReset');
locationResetButton.addEventListener('click', (event) => clearLocation());
};

document.addEventListener('DOMContentLoaded', registerEventHandlers);
tempChange(0, false);

Choose a reason for hiding this comment

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

👍

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