This commit is contained in:
garrying
2021-05-09 15:50:25 +00:00
parent efa86da2a0
commit 1794359585
44 changed files with 368 additions and 365 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
assets/js/d3.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -144,8 +144,6 @@ if (typeof window.graphDataIndex !== 'undefined') {
// Notes graph
const d3 = window.d3
if (typeof window.graphData !== 'undefined') {
const MINIMAL_NODE_SIZE = 10
const MAX_NODE_SIZE = 16
@ -404,10 +402,15 @@ const capitalize = str => `${str.charAt(0).toUpperCase()}${str.slice(1)}`
const conditionsContainer = document.getElementById('gardenConditions')
const openWeatherUrl = 'https://garden-weather-api.vercel.app/weather/toronto'
if (conditionsContainer) {
window.fetch(openWeatherUrl)
.then(response => response.json())
.then(data => {
document.getElementById('gardenConditions').innerHTML = `${capitalize(data.weather[0].description)}, ${Math.round(data.main.temp)}°C`
})
async function fetchWeather() {
let response = await window.fetch(openWeatherUrl)
let weatherData = await response.json()
conditionsContainer.innerHTML = `${capitalize(weatherData.weather[0].description)}, ${Math.round(weatherData.main.temp)}°C`
conditionsContainer.classList.remove('dn')
}
if (conditionsContainer) {
fetchWeather().catch(e => {
console.log('There has been a problem with getting the weather ' + e.message);
});
}