3.0.2
Fix the Why It Feels calcs
This commit is contained in:
+9
-7
@@ -742,6 +742,7 @@ export function UTCIForecast() {
|
||||
</div>
|
||||
${(() => {
|
||||
const _wflItems = [
|
||||
{ label: 'Air temperature', icon: '🌡', value: currentRow.Ta, isBase: true },
|
||||
{ label: 'Sun and sky', icon: '☀', value: whyFeelsLike.sunAndSky },
|
||||
{ label: 'Wind', icon: '🌬', value: whyFeelsLike.wind },
|
||||
{ label: 'Humidity', icon: '💧', value: whyFeelsLike.humidity },
|
||||
@@ -752,19 +753,20 @@ export function UTCIForecast() {
|
||||
{ label: 'Precipitation', icon: '🌧', value: whyFeelsLike.precipitation }
|
||||
] : []),
|
||||
];
|
||||
const _wflMax = Math.max(..._wflItems.map(i => Math.abs(i.value)), 0.1);
|
||||
return _wflItems.map(({ label, icon, value }) => html`
|
||||
<div class="insight-row" key=${label}>
|
||||
const _wflDeltaItems = _wflItems.filter(i => !i.isBase);
|
||||
const _wflMax = Math.max(..._wflDeltaItems.map(i => Math.abs(i.value)), 0.1);
|
||||
return _wflItems.map(({ label, icon, value, isBase }) => html`
|
||||
<div class=${'insight-row' + (isBase ? ' insight-row--base' : '')} key=${label}>
|
||||
<span class="insight-icon">${icon}</span>
|
||||
<span class="insight-label">
|
||||
${label}
|
||||
<span class="insight-bar-track">
|
||||
${!isBase && html`<span class="insight-bar-track">
|
||||
<span class=${'insight-bar ' + (value >= 0 ? 'bar-pos' : 'bar-neg')}
|
||||
style=${{ width: `${Math.round(Math.abs(value) / _wflMax * 100)}%` }}></span>
|
||||
</span>
|
||||
</span>`}
|
||||
</span>
|
||||
<span class=${`insight-delta ${value >= 0 ? 'delta-pos' : 'delta-neg'}`}>
|
||||
${value >= 0 ? '+' : ''}${value.toFixed(1)}°
|
||||
<span class=${`insight-delta ${isBase ? 'delta-base' : value >= 0 ? 'delta-pos' : 'delta-neg'}`}>
|
||||
${isBase ? '' : value >= 0 ? '+' : ''}${value.toFixed(1)}°
|
||||
</span>
|
||||
</div>
|
||||
`);
|
||||
|
||||
Reference in New Issue
Block a user