also add freedom units to the other one

This commit is contained in:
bignutty 2024-08-05 19:24:09 +02:00
parent 785b0c306c
commit f99efdf813

View file

@ -24,7 +24,10 @@ function temperature(value, units){
} }
function renderWeatherCard(context, data, units){ function renderWeatherCard(context, data, units){
let description = `### ${weatherIcon(data.result.current.icon.id)} ${temperature(data.result.current.temperature.current, units)}${data.result.current.condition.label}\n\n${pill("Feels like")} ${smallPill(temperature(data.result.current.temperature.feels_like, units))} ${pill("Wind")} ${smallPill(data.result.current.wind.speed + " km/h")}` let description = `### ${weatherIcon(data.result.current.icon.id)} ${temperature(data.result.current.temperature.current, units)}${data.result.current.condition.label}\n\n${pill("Feels like")} ${smallPill(temperature(data.result.current.temperature.feels_like, units))} ${pill("Wind")} `
if(units == "°F") description += smallPill((data.result.current.wind.speed / 1.609).toFixed(2) + " mph")
else description += smallPill((data.result.current.wind.speed).toFixed(2) + " km/h")
let secondaryPills = []; let secondaryPills = [];
if(data.result.current.humidity > 0) secondaryPills.push(`${pill("Humidity")} ${smallPill(Math.floor(data.result.current.humidity * 100) + "%")}`) if(data.result.current.humidity > 0) secondaryPills.push(`${pill("Humidity")} ${smallPill(Math.floor(data.result.current.humidity * 100) + "%")}`)